Skip to content

Fix: re-scrub meta content rewrites and noscript re-renders#180

Merged
twschiller merged 1 commit into
mainfrom
followup/177-meta-noscript-coverage
Jun 5, 2026
Merged

Fix: re-scrub meta content rewrites and noscript re-renders#180
twschiller merged 1 commit into
mainfrom
followup/177-meta-noscript-coverage

Conversation

@twschiller
Copy link
Copy Markdown
Contributor

Closes #177.

Summary

Closes the two coverage gaps left open by #176's scrub-don't-detach refactor.

  • meta-injection-strip — after Fix: scrub instead of detach for framework-rendered DOM #176, the meta stays attached. If a framework or page script later overwrites content= on a meta we already blanked, the new payload was visible until the next route change. Added "content" to OBSERVED_ATTRIBUTES in subtree-watcher.ts and observeAttributes: true on both watchers so the rewrite delivers the meta back into scrubMeta.
  • noscript-stripstripNoscript only walked downward, so when children were rendered INTO a kept <noscript> the new fallback wasn't recognized. Replaced the self-only branch with a closest("noscript") ancestor-or-self check; an addition under a kept noscript re-blanks the wrapper.

Each is a low-likelihood path in practice (frameworks rarely re-render noscript children, and content-attribute rewrites are usually paired with full route swaps), but both are real and pre-#176 they were masked by the detach.

Coverage notes

  • The content mutation also reaches selector-token-index (the other observeAttributes: true subscriber). collectTokens is a no-op for token-less mutations, so impact is bounded to a complex-selector scan against the meta element.
  • closest("noscript") on the added subtree subsumes the prior self-only branch — semantics are unchanged for additions that are themselves a <noscript>.

Out of scope

Test plan

  • bun run test in extension/: 1383 / 1383 passing across 77 suites (3 new — 1 noscript, 2 meta).
  • bun run check clean.
  • Manual repro on the demo site: navigation still works after the change (no new framework-tracked-node detach paths introduced).

🤖 Generated with Claude Code

Closes the two coverage gaps left open by #176's scrub-don't-detach
refactor:

- `meta-injection-strip` — an in-place `content=` rewrite on a meta we
  already blanked sat visible until the next route change. Added
  `content` to `OBSERVED_ATTRIBUTES` and `observeAttributes: true` on
  both watchers so the rewrite reaches `scrubMeta`.
- `noscript-strip` — children rendered INTO a kept `<noscript>` weren't
  recognized because `stripNoscript` only walked downward. Replaced the
  self-only branch with a `closest(\"noscript\")` ancestor-or-self check
  so additions under a kept noscript re-trigger blanking of the wrapper.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 5, 2026

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 9:38pm

Request Review

@twschiller twschiller added the bug Something isn't working label Jun 5, 2026
@twschiller twschiller merged commit 793e674 into main Jun 5, 2026
7 checks passed
@twschiller twschiller deleted the followup/177-meta-noscript-coverage branch June 5, 2026 21:40
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.

Close meta-injection-strip / noscript-strip coverage gaps from #176 scrub-don't-detach refactor

1 participant