Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix cross-origin-frame-redact watcher missing top-level iframes#140

Merged
twschiller merged 1 commit into
mainfrom
fix/cross-origin-frame-redact-watcher-scope
Jun 5, 2026
Merged

Fix cross-origin-frame-redact watcher missing top-level iframes#140
twschiller merged 1 commit into
mainfrom
fix/cross-origin-frame-redact-watcher-scope

Conversation

@twschiller

Copy link
Copy Markdown
Contributor

Stacked on #139 — merge that first. Review only the fix commit.

Summary

  • The watcher's onSubtrees handed each added subtree root to scan(), which calls root.querySelectorAll("iframe"). querySelectorAll matches descendants only, so a bare cross-origin <iframe> appended directly to document.body slipped past the watcher (the iframe itself is the root, and it has no iframe descendants).
  • Mirrors the workaround already documented in selector-hide-rule.ts:148-163: drop the per-root loop and rescan from document.body on every batch. The is-connected / is-revealed checks in scan() keep it idempotent and the watcher's throttle coalesces bursts.
  • Adds a regression test that appends a bare iframe directly to body.

Test plan

  • New regression test passes (replaces a bare cross-origin iframe appended directly to body)
  • All 19 tests in cross-origin-frame-redact.test.ts pass
  • bun run preflight passes

🤖 Generated with Claude Code

@vercel

vercel Bot commented Jun 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-browser-shield-demo-site Ready Ready Preview, Comment Jun 5, 2026 1:07am

Request Review

@twschiller twschiller added the bug Something isn't working label Jun 5, 2026
Base automatically changed from coverage/cross-origin-frame-redact-tests to main June 5, 2026 01:07
The watcher's onSubtrees handed each added subtree root to scan(), which
calls querySelectorAll('iframe') on it. querySelectorAll matches
descendants only, so a bare cross-origin <iframe> appended directly to
document.body slipped past the watcher (the iframe itself is the root,
and it has no iframe descendants).

Mirror the workaround already documented in selector-hide-rule.ts: drop
the per-root loop and rescan from document.body on every batch. The
is-connected / is-revealed checks in scan() keep it idempotent, and the
watcher's throttle coalesces bursts.

Add a regression test that appends a bare iframe directly to body.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@twschiller twschiller force-pushed the fix/cross-origin-frame-redact-watcher-scope branch from ec081a3 to ef33206 Compare June 5, 2026 01:07
@twschiller twschiller merged commit 9c65a28 into main Jun 5, 2026
7 checks passed
@twschiller twschiller deleted the fix/cross-origin-frame-redact-watcher-scope branch June 5, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant