Repository navigation
Cherry-pick(s) 2e63eaf64497. rdar://191051699 - #78737
Closed
webkit-opensource-integration wants to merge 1 commit into
Closed
webkit-opensource-integration wants to merge 1 commit into
webkit-opensource-integration wants to merge 1 commit into
Conversation
https://bugs.webkit.org/show_bug.cgi?id=322242 rdar://183463022 Reviewed by Wenson Hsieh. The setters of innerHTML and outerHTML re-uses the same document fragment for parsing purposes as a performance optimization. There is a further performance optimization in ContainerNode::removeAllChildrenWithScriptAssertion to avoid calling Node::removingSteps on the freshly parsed DOM tree under the document fragment for innerHTML and outerHTML. This leaves Node::m_shadowIncludingRoot to remain pointing to the document fragment even after they had logically been removed from the fragment. This is ordinarily fine because the newly parsed DOM tree gets inserted into the context object of innerHTML and outerHTML right away so insertionSteps will update Node::m_shadowIncludingRoot. However, when a XML parser encounters a parsing error, it pauses the process midway and exit early before Element::setOuterHTML had a chance to insert the new DOM tree to the context object. If XML parser had constructed any custom elements by that point, those constructors will still get called while the elements are a part of the reused document fragment, exposing it to scripts. When script then removes the node from the document fragment, the performance optimization to avoid calling Node::removingSteps in ContainerNode::removeAllChildrenWithScriptAssertion kicks in and leaves DOM tree in an inconsistent state with a stale pointer in Node::m_shadowIncludingRoot. Fix the bug by disabling the document fragment reuse when parsing XML. XML parser isn't optimized for performance anyway. Test: fast/dom/xml-parser-error-during-inner-outer-html-crash.html * LayoutTests/fast/dom/xml-parser-error-during-inner-outer-html-crash-expected.txt: Added. * LayoutTests/fast/dom/xml-parser-error-during-inner-outer-html-crash.html: Added. * Source/WebCore/editing/markup.cpp: (WebCore::createFragmentForMarkup): Originally-landed-as: 316606.427@safari-7625-branch (2e63eaf). rdar://191051699
Collaborator
|
EWS run on current version of this PR (hash 6b1ac92) Details |
Author
Author
|
At the time this pull request was created the following files were in conflict and need to be resolved:
|
Member
|
We should instead merge rdar://191058513. |
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.
Integration has hit a merge conflict while cherry-picking rdar://191051699 to main. [2e63eaf] caused a merge conflict.
ℹ️ Info
RC_REMOVE_SEC_ACCEL_*guards were removed with unifdef before cherry-picking, keeping only the code built when the macro is not defined.6b1ac92