Skip to content

fix(bsk): capture controlled tabs without activating them | 支持无需激活的受控后台标签页的视口截图 - #250

Merged
iuyo5678 merged 4 commits into
mainfrom
fix/background-tab-screenshots
Sep 18, 2026
Merged

iuyo5678 merged 4 commits into
mainfrom
fix/background-tab-screenshots

Conversation

@Ljy-0827

Copy link
Copy Markdown
Collaborator

问题

PR #249 已让受控后台页面持续执行,但普通视口截图仍要求目标标签处于活动状态,自动化任务需要图片观察时仍会受阻。

现有截图优先使用窗口级 captureVisibleTab。仅移除 active 检查可能截到同窗口的其他活动标签,无法保证图像属于指定目标。

修改

  • 受控目标的普通视口截图直接使用绑定 tabId 的 CDP 捕获,无论目标当前是否 active。
  • 不激活标签、不聚焦窗口,也不在目标捕获失败时回退到窗口级截图。
  • 捕获前后校验主文档、debugger attachment 和控制关系,丢弃无法确认归属或已取消的结果。
  • 复用现有扩展遮罩隐藏与恢复流程,避免清理命令作用于替换后的 attachment。
  • 同步技能说明,明确后台视口截图及现有 Canvas 点击的使用边界。

验证

  • 扩展测试:1694 项通过,95 项按配置跳过。
  • TypeScript、Biome、diff 检查及生产扩展构建通过。
  • 独立 Chrome 两档 DPR/缩放回归通过,覆盖视口尺寸、滚动、双后台目标及 DOM/Canvas 交互。
  • 真实 bsk 回归通过:
    • 两张后台页分别返回自己的画面,没有串图。
    • 点击 A 页后截图更新,B 页画面保持不变。
    • Canvas 截图返回 capture_id,绑定点击后像素正确更新。
    • 各步骤采样目标均为 active=false,测试 Session 已清理。

Related to #230

@Ljy-0827
Ljy-0827 added this pull request to stack #251 September 15, 2026 06:44
@Ljy-0827
Ljy-0827 force-pushed the fix/background-tab-screenshots branch from 6cb6937 to 4015dd3 Compare September 15, 2026 09:40
@Ljy-0827
Ljy-0827 force-pushed the fix/background-tab-execution branch from e8f4d94 to 47a4811 Compare September 15, 2026 11:19
@Ljy-0827
Ljy-0827 force-pushed the fix/background-tab-screenshots branch from 4015dd3 to b36041d Compare September 15, 2026 11:21
@Ljy-0827 Ljy-0827 changed the title fix(bsk): capture controlled tabs without activating them fix(bsk): capture controlled tabs without activating them | 支持无需激活的受控后台标签页的视口截图 Sep 15, 2026
@Ljy-0827
Ljy-0827 marked this pull request as ready for review September 15, 2026 11:24
@Ljy-0827
Ljy-0827 requested a review from iuyo5678 September 15, 2026 11:55
@Ljy-0827
Ljy-0827 force-pushed the fix/background-tab-execution branch from 47a4811 to bd603e4 Compare September 16, 2026 03:05
@Ljy-0827
Ljy-0827 force-pushed the fix/background-tab-screenshots branch 3 times, most recently from 36c4119 to 4e7fceb Compare September 16, 2026 07:13
@Ljy-0827
Ljy-0827 force-pushed the fix/background-tab-execution branch from bd603e4 to d3f9e91 Compare September 17, 2026 07:37
@Ljy-0827
Ljy-0827 marked this pull request as draft September 17, 2026 07:45
@Ljy-0827
Ljy-0827 force-pushed the fix/background-tab-screenshots branch from 4e7fceb to 803482b Compare September 17, 2026 07:47
@Ljy-0827
Ljy-0827 removed this pull request from stack #251 September 17, 2026 08:03
@Ljy-0827
Ljy-0827 marked this pull request as ready for review September 17, 2026 08:32
@iuyo5678
iuyo5678 changed the base branch from fix/background-tab-execution to main September 18, 2026 13:02
@iuyo5678
iuyo5678 merged commit 64ea064 into main Sep 18, 2026
6 checks passed
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.

Background tabs may not finish rendering until activated | 后台 Tab 需激活后才能完成页面渲染

2 participants