Repository navigation
Conversation
An unrelated extension that injects a hidden chrome-extension:// iframe (the pattern many shopping and translate extensions use) made every collection for the tab fail with "Cannot access a chrome-extension:// URL of different extension". collectCooperationFrames tolerated only a missing receiver, so this rejection escaped as a fatal error and cooperate sync, observe, snapshot, navigate and debug start all failed while the tab itself was healthy. Skip child documents that host an extension page before messaging them. Such a document cannot carry human input, so leaving it out cannot conceal activity, and the top document is exempt so a tab that really is an extension page keeps its existing failure path. Refs Tencent#686
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5d213456a7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| gaps.push({ ...frameIdentity(frame), reason: "inactive_document" }); | ||
| return false; | ||
| } | ||
| if (isChildExtensionPage(frame)) return false; |
There was a problem hiding this comment.
Retain visibility checks for extension-hosted frames
If another extension injects a visible or focused iframe, this skips it exactly like a hidden one, although extension documents can contain clickable controls and text fields. The parent collector cannot observe events inside that document, and CooperationController.humanActive() only scans collected frames, so a fresh sync can authorize automation while the user is still interacting there. Previously the frame had to be proven hidden by provenHiddenFrames() or collection failed. Keep that hidden/unfocused-owner proof for this exemption instead of treating the URL scheme as proof that human input is impossible.
Useful? React with 👍 / 👎.
| gaps.push({ ...frameIdentity(frame), reason: "inactive_document" }); | ||
| return false; | ||
| } | ||
| if (isChildExtensionPage(frame)) return false; |
There was a problem hiding this comment.
Preserve hidden ancestry when filtering extension frames
If a hidden extension iframe contains an about:blank child with an inherited extension origin, the outer frame is removed but the child is still read. Once that read fails, provenHiddenFrames() probes the inaccessible extension parent and cannot establish that the child is hidden. With mocked Chrome APIs, the parent commit succeeds for this inventory by proving the outer owner hidden and propagating that proof; this commit throws and aborts the entire collection. Preserve hidden-ancestor handling when excluding the outer frame so nested documents do not reintroduce the tab-wide failure.
Useful? React with 👍 / 👎.
Address both review findings. A URL scheme is not proof that nobody can interact with a document: an unreachable but displayed extension iframe can hold controls and text fields that no collector watches, so a fresh sync could authorize automation while the user is typing there. The outermost unreachable frame is now proven hidden with the existing provenHiddenFrames() machinery, and a displayed one still fails the collection - naming the frame instead of forwarding Chrome's raw message. Release skips the proof so it never blocks on a document it cannot reach. Descendants of an unreachable frame inherit that origin and are unreachable too, even when their own URL is about:blank. Marking the whole subtree keeps nested documents from reintroducing the tab-wide failure the proof would otherwise hit on an unreadable parent.
|
Both findings were right — addressed in 9f21adb. P1 (visibility proof). Took the suggestion literally: the exemption no longer rests on the URL scheme. P2 (hidden ancestry). Descendants of an unreachable frame inherit its origin, so the whole subtree is marked, not just the outer frame. That also removes the case where an Tests: 49 in |
|
Great work! |
Summary
Fixes #686.
cooperate sync— and every other CDP-backed command that walks frames (observe,snapshot,navigate,debug start) — failed for the whole tab withCannot access a chrome-extension:// URL of different extensionas soon as any other installed extension injected an iframe into the page (the pattern many shopping, coupon and translate extensions use). The tab, the daemon and the BrowserSkill extension were all healthy; only observation was broken, and disabling the unrelated extension was the only workaround.Root cause (Why)
chrome.webNavigation.getAllFrames()reports that injected frame like any other child document.collectCooperationFrames()tolerated exactly one rejection kind — a missing receiver:Chrome refuses
tabs.sendMessageinto a document owned by a different extension withCannot access a chrome-extension:// URL of different extension, which is not a missing receiver, so it was rethrown and escaped the collection as a fatal error.Change
unreachableExtensionSubtrees()— child documents that host an extension page, plus every descendant that inherits that origin (about:blank,srcdoc), are marked unreachable. They are excluded fromlive, so nothing messages them.requireUnreachableFramesHidden()— a URL scheme is not proof that nobody can interact with a document. Before the subtree is left out, the outermost unreachable frames are proven hidden with the existingprovenHiddenFrames()machinery (owner geometry,checkVisibility, focus path,pointer-events). An unreachable but displayed frame can hold controls and text fields that no collector watches, so it still fails the collection — now naming the frame instead of forwarding Chrome's raw message:{"code":"permission_denied","message":"Page frames cannot be observed: 2 (chrome-extension:)", "data":{"reason":"frame_unobservable","effect_state":"none","frames":[{"frame_id":2,"url":"chrome-extension:"}]}}Release skips the proof (
COOPERATION_DISABLE), because it must not block on a document it can never reach.The top document stays exempt, so a tab that really is an extension page keeps its existing failure path instead of silently collecting nothing.
Tests
Four cases in
browser-bridge.test.ts, all with the frame inventory and owner facts mocked:skips a hidden child frame that hosts another extension's pagedoes not reach documents nested inside an unreachable extension frameabout:blankchild of the extension frame is never messagedstill fails, naming the frame, when an extension frame is displayedframe_unobservablewithframe_id: 2instead of the whole sync failing on Chrome's messagereleases without proving extension frames hiddenCOOPERATION_DISABLEnever sends an owner probeLocal verification:
browser-bridge.test.ts49 passed; full extension unit suite 4108 passed / 8 skipped (pre-existing);tsc --noEmitclean;biome checkclean; bilingual changelog sync passes.Revision note
The first version skipped any extension-hosted child frame on the strength of its URL alone. Review was right that this hides a real safety hole:
CooperationController.humanActive()only scans collected frames, so automation could be authorized while the user was interacting inside a visible foreign widget. The current version keeps that proof requirement.Notes
gaps, becauseCooperateFrameGapReasonis generated frombsk-protocol. A dedicatedinaccessible_framereason would be the more transparent report; happy to add it plus the schema regeneration if you want the diagnostic surfaced to the CLI.cooperate syncsucceeds and the hidden injected frame simply does not appear.