Skip to content

Guard both node and parser documents against dynamic markup insertion - #13319

Open
noamr wants to merge 1 commit into
mainfrom
noamr/patch-dynamic-markup-counter
Open

noamr wants to merge 1 commit into
mainfrom
noamr/patch-dynamic-markup-counter

Conversation

@noamr

@noamr noamr commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Increment and decrement the throw-on-dynamic-markup-insertion counter in prepare content patching around its node removal loop (addressing item 3 of #13036), and also guard the parser's Document whenever it differs from the node document in both prepare content patching and create an element for a token.

When script moves a patch's insertion target or an open element into another document mid-parse, guarding only the node document leaves the parser's Document open to re-entrant document.write() or document.open() calls during tree construction, while guarding only the parser's Document leaves streaming fragment parsers unguarded on the target's node document.

Tests: web-platform-tests/wpt#65593.

Fixes #13317. Partially addresses #13036.


/dynamic-markup-insertion.html ( diff )
/parsing.html ( diff )
/scripting.html ( diff )

Increment and decrement the throw-on-dynamic-markup-insertion counter in prepare content patching around its node removal loop (addressing item 3 of #13036), and also guard the parser's Document whenever it differs from the node document in both prepare content patching and create an element for a token.

When script moves a patch's insertion target or an open element into another document mid-parse, guarding only the node document leaves the parser's Document open to re-entrant document.write() or document.open() calls during tree construction, while guarding only the parser's Document leaves streaming fragment parsers unguarded on the target's node document.

Fixes #13317.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Patching can guard the wrong document's throw-on-dynamic-markup-insertion counter

1 participant