Repository navigation
Conversation
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.
noamr
marked this pull request as ready for review
November 23, 2026 16:40
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.
Increment and decrement the
throw-on-dynamic-markup-insertion counterinprepare content patchingaround its node removal loop (addressing item 3 of #13036), and also guard the parser'sDocumentwhenever it differs from the node document in bothprepare content patchingandcreate an element for a token.When script moves a patch's
insertion targetor an open element into another document mid-parse, guarding only the node document leaves the parser'sDocumentopen to re-entrantdocument.write()ordocument.open()calls during tree construction, while guarding only the parser'sDocumentleaves streaming fragment parsers unguarded on the target's node document.Tests: web-platform-tests/wpt#65593.
Fixes #13317. Partially addresses #13036.
scopeguard inpatch.cc; assigned on Patching can guard the wrong document's throw-on-dynamic-markup-insertion counter #13317)<template for>in Implement out-of-order streaming using <template for> WebKit/WebKit#76083; filed Patching can guard the wrong document's throw-on-dynamic-markup-insertion counter #13317)pagehide)<template for>)/dynamic-markup-insertion.html ( diff )
/parsing.html ( diff )
/scripting.html ( diff )