Skip to content

Commit 623fb28

Browse files
committed
feat: 借助 webNavigation 区分真刷新与 SPA 切换
新增 webNavigation 权限,监听 onCommitted 顶层 frame 事件。reload/typed/link/back 等真正 document 级 navigation 触发时清识别节流、立即重检;SPA 内部 history.pushState/replaceState 不触发 onCommitted、节流仍在保护反复触发。F5 真刷新即刻重检的预期得到满足。将版本号提升到 1.2.90。
1 parent 0971ef3 commit 623fb28

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "stackprism",
33
"private": true,
4-
"version": "1.2.89",
4+
"version": "1.2.90",
55
"type": "module",
66
"description": "StackPrism 用于检测网页前端、后端、CDN、SaaS、广告营销、统计、登录、支付、网站程序和主题模板线索。",
77
"scripts": {

src/background/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
8787
}
8888
})
8989

90+
chrome.webNavigation.onCommitted.addListener(details => {
91+
if (details.frameId !== 0) return
92+
console.log('[SP detection] webNav committed', details.tabId, 'transition:', details.transitionType, details.url)
93+
clearDetectionThrottle(details.tabId)
94+
})
95+
9096
chrome.storage.onChanged.addListener((changes, areaName) => {
9197
if (areaName === 'sync' && changes[SETTINGS_STORAGE_KEY]) {
9298
applyDetectorSettingsUpdate(changes[SETTINGS_STORAGE_KEY].newValue)

src/manifest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default defineManifest({
66
name: 'StackPrism',
77
description: 'StackPrism 用于检测网页前端、后端、CDN、SaaS、广告营销、统计、登录、支付、网站程序和主题模板线索。',
88
version: pkg.version,
9-
permissions: ['activeTab', 'scripting', 'tabs', 'storage', 'webRequest'],
9+
permissions: ['activeTab', 'scripting', 'tabs', 'storage', 'webRequest', 'webNavigation'],
1010
host_permissions: ['<all_urls>'],
1111
background: {
1212
service_worker: 'src/background/index.ts',

0 commit comments

Comments
 (0)