Conversation
Ljy-0827
force-pushed
the
fix/download-popup-capture
branch
from
September 17, 2026 08:25
c140ccd to
83cc415
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题描述
当页面中的下载链接使用
target="_blank"打开,并由服务端通过Content-Disposition: attachment返回文件时,BrowserSkill 无法将该文件下载到 Agent 指定的本地路径。用户侧表现为:
about:blank新标签页。bsk download无法确认该下载属于当前操作,最终等待超时。根因
此类链接的浏览器执行流程是:
about:blank只是新标签页导航开始时的占位文档。由于响应被浏览器作为附件处理,新标签页不会提交或渲染实际页面。原有下载捕获逻辑要求同时取得:
Page.downloadWillBegin;chrome.downloads下载候选。但在该场景中,下载意图属于新建的瞬时 target,而不是原始点击页面。原页面不会收到对应的
Page.downloadWillBegin,BrowserSkill 虽然可以观察到全局下载候选,却无法安全证明它属于本次点击,因此不会认领该文件并最终超时。解决方案
为直接下载链接增加基于点击目标的可信下载意图:
_blank的 HTTP(S) 链接时,记录其规范化后的绝对href。chrome.downloads候选的url、finalUrl进行精确匹配。普通按钮下载、Blob 下载、脚本触发下载和 Frame 下载仍然使用原有的精确 CDP 下载意图,不改变现有行为。
架构与安全边界
本次修改没有将弹出的
about:blank标签页永久加入 Session,也没有扩大 Agent 的页面控制范围。新的 URL 意图来源于本次操作已经精确解析的 DOM 节点,因此仍然与具体点击目标绑定,而不是对浏览器全局下载事件进行宽泛匹配。
对应 Issue #258