Skip to content

fix: 修复 dashboard 自动刷新失效#40

Open
KanoCifer wants to merge 8 commits into
V-IOLE-T:mainfrom
KanoCifer:fix/tab-change-notify-runtime-channel
Open

fix: 修复 dashboard 自动刷新失效#40
KanoCifer wants to merge 8 commits into
V-IOLE-T:mainfrom
KanoCifer:fix/tab-change-notify-runtime-channel

Conversation

@KanoCifer

Copy link
Copy Markdown
Contributor
  • 改为 chrome.runtime.sendMessage 广播,命中 dashboard 与 popup 两个 runtime 监听。

  • 测试:新增 background-notify.test.js 行为测试(广播通道、错误吞掉逻辑), 并修正 ui-regression.test.js 对注释中残留旧 API 的假阳性断言。

  • manifest.json: 版本号 1.1.1->1.1.2。

关联issue #39

- 改为 chrome.runtime.sendMessage 广播,命中 dashboard 与 popup 两个
  runtime 监听。

- 测试:新增 background-notify.test.js 行为测试(广播通道、错误吞掉逻辑),
  并修正 ui-regression.test.js 对注释中残留旧 API 的假阳性断言。

- manifest.json: 版本号 1.1.1->1.1.2。
Copilot AI review requested due to automatic review settings July 8, 2026 16:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 旨在修复 Issue #39 中「新标签页 dashboard 自动刷新失效」的问题:background 侧不再走 content script 通道,而改用 chrome.runtime.sendMessage 向扩展内页面广播 tabs-changed,以命中 dashboard 与 popup 的 runtime.onMessage 监听,从而恢复自动刷新链路。

Changes:

  • background.js:将 tab 变更通知改为 chrome.runtime.sendMessage 广播 tabs-changed 消息。
  • 新增 background-notify.test.js:覆盖广播通道与错误吞掉/告警行为。
  • ui-regression.test.js:更新对 background 通知实现的回归断言;manifest.json:版本号 1.1.1 → 1.1.2 并格式化 permissions。

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
extension/background.js 将 tab 变更通知改为 runtime 广播,减少对 tab 查询/逐 tab 发送的依赖
extension/background-notify.test.js 新增行为测试,验证广播与错误处理预期
extension/ui-regression.test.js 更新回归断言以反映新的通知机制
extension/manifest.json 版本号升级并调整 permissions 的格式
Comments suppressed due to low confidence (1)

extension/ui-regression.test.js:1068

  • ui-regression.test.js 里对 background.js 的字符串断言仍硬编码了单引号(例如 action/source),但 background.js 本次改动已改为双引号。这样这些 assert.match 会变成假阴性并导致测试失败;建议用 ['"] 同时匹配单/双引号,或改为与 background.js 当前风格一致。
  assert.doesNotMatch(bgJs, /await chrome\.tabs\.sendMessage/);
  assert.match(bgJs, /action:\s*'tabs-changed'/);
  assert.match(bgJs, /triggerTabId/);
  assert.match(bgJs, /source:\s*'tabs\.onCreated'/);
  assert.match(bgJs, /source:\s*'tabs\.onUpdated'/);

Comment thread extension/background.js
Copilot AI review requested due to automatic review settings July 8, 2026 17:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread extension/ui-regression.test.js Outdated
Comment thread extension/background.js Outdated
  背景广播无接收方错误消息匹配中英双语(/接收端不存在|Receiving end/i)
  真正异常添加去重保护避免刷屏(notifyTabHarborPages._lastWarn)
  ui-regression 断言收紧禁止任何形式 chrome.tabs.sendMessage
  (此前仅排除 await 前缀写法)
Copilot AI review requested due to automatic review settings July 8, 2026 17:18
将 tab 变更通知从 content script 通道改为 chrome.runtime.sendMessage
广播,命中 dashboard 与 popup 的 runtime.onMessage 监听。

- 静默吞掉无接收方时的连接错误(兼容中英双语消息)
- 非连接类异常添加去重保护避免刷屏
- 新增 background-notify.test.js 行为测试
- 同步更新 ui-regression.test.js 断言,收紧 chrome.tabs.sendMessage 检查
- manifest.json 版本号 1.1.1 -> 1.1.2

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread extension/background.js
Comment thread extension/ui-regression.test.js
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 8, 2026 17:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 8, 2026 17:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

KanoCifer added 2 commits July 9, 2026 01:43
groupMap.__landing_pages__ = undefined 在 groupMap 中残留一个
undefined 值,导致 Object.values 后 sort 比较器访问 a.domain
时抛出 TypeError。当用户打开了落地页域名根路径的标签页时触发,
表现为标签页变更后 dashboard 渲染失败。
chrome.runtime.sendMessage 在 dashboard 与 popup 都关闭时必定抛
"Receiving end does not exist",这是正常现象。原 catch 仍 console.warn
产生噪音日志。改为仅当错误非该连接错误时才告警。
Copilot AI review requested due to automatic review settings July 8, 2026 17:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants