Branch: refs/heads/webkitglib/2.50
Home: https://github.com/WebKit/WebKit
Commit: 1c4bb9fbdf238492143ef4f8de77982792118f02
https://github.com/WebKit/WebKit/commit/1c4bb9fbdf238492143ef4f8de77982792118f02
Author: Ryosuke Niwa <[email protected]>
Date: 2026-01-16 (Fri, 16 Jan 2026)
Changed paths:
A
LayoutTests/fast/dom/insert-new-child-to-remove-during-mutation-events-crash-expected.txt
A
LayoutTests/fast/dom/insert-new-child-to-remove-during-mutation-events-crash.html
A
LayoutTests/fast/dom/insert-new-child-to-remove-during-unload-crash-expected.txt
A LayoutTests/fast/dom/insert-new-child-to-remove-during-unload-crash.html
M Source/WebCore/dom/ContainerNode.cpp
Log Message:
-----------
Cherry-pick 305651@main (a9934374583d).
https://bugs.webkit.org/show_bug.cgi?id=305494
Crash in Node::invalidateNodeListAndCollectionCachesInAncestors via
ContainerNode::removeAllChildrenWithScriptAssertion
https://bugs.webkit.org/show_bug.cgi?id=305494
Reviewed by Geoffrey Garen and Wenson Hsieh.
The crash was caused by ContainerNode::removeAllChildrenWithScriptAssertion
sometimes deleting a child node before
node lists of the parent node are invalidated. When node lists' iterator
type uses a CheckedPtr internally, this
can lead to a crash during the invalidation (because invalidation will try
to clear that outliving CheckedPtr).
Fixed the bug by re-collecting child nodes of the parent node in
ContainerNode::removeAllChildrenWithScriptAssertion
if the DOM tree version has changed between when we collected child nodes
and when mutation events and unload event
handlers are dispatched.
Tests: fast/dom/insert-new-child-to-remove-during-mutation-events-crash.html
fast/dom/insert-new-child-to-remove-during-unload-crash.html
*
LayoutTests/fast/dom/insert-new-child-to-remove-during-mutation-events-crash-expected.txt:
Added.
*
LayoutTests/fast/dom/insert-new-child-to-remove-during-mutation-events-crash.html:
Added.
*
LayoutTests/fast/dom/insert-new-child-to-remove-during-unload-crash-expected.txt:
Added.
* LayoutTests/fast/dom/insert-new-child-to-remove-during-unload-crash.html:
Added.
* Source/WebCore/dom/ContainerNode.cpp:
(WebCore::ContainerNode::removeAllChildrenWithScriptAssertion):
Canonical link: https://commits.webkit.org/305651@main
Canonical link: https://commits.webkit.org/298234.387@webkitglib/2.50
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications