Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 18f7c49e6bdbdfa98ef3a3122e9e96fa0f01aa07
https://github.com/WebKit/WebKit/commit/18f7c49e6bdbdfa98ef3a3122e9e96fa0f01aa07
Author: Ryosuke Niwa <[email protected]>
Date: 2026-04-06 (Mon, 06 Apr 2026)
Changed paths:
A
LayoutTests/fast/animation/request-animation-frame-during-dom-mutation-expected.txt
A
LayoutTests/fast/animation/request-animation-frame-during-dom-mutation.html
M Source/WebCore/dom/ScriptedAnimationController.cpp
M Source/WebCore/html/HTMLVideoElement.cpp
Log Message:
-----------
REGRESSION(309388@main): Crash in core DOM code due to malformed DOM tree
https://bugs.webkit.org/show_bug.cgi?id=311243
rdar://173397633
Reviewed by Chris Dumez.
The crash was caused by a malformed DOM tree. This happens because removing an
iframe can trigger
in WebKitTestRunner / DumpRenderTree to update the rendering synchronously
during a node removal.
This in turn could run arbitrary scripts via requestAnimationFrame. But because
it don't call
ScriptController::canExecuteScripts, it does not increment
s_scriptExecutionCount. As a result,
the secondary check for when scripts mutated DOM in ContainerNode::insertBefore
does not get
triggered and results in a malformed DOM.
Fixed the bug by calling canExecuteScripts in
serviceRequestAnimationFrameCallbacks to update
s_scriptExecutionCount so that the secondary pre-insertion check gets
triggered. Due to the way
run-webkit-tests interacts with WebKitTestRunner, run-webkit-tests does not hit
this crash while
manually calling WebKitTestRunner via run-test-runner will hit it. The attached
test case does
reproduce the crash in DumpRenderTree.
This PR also fixes serviceRequestVideoFrameCallbacks but unfortunately without
a test case.
Test: fast/animation/request-animation-frame-during-dom-mutation.html
*
LayoutTests/fast/animation/request-animation-frame-during-dom-mutation-expected.txt:
Added.
* LayoutTests/fast/animation/request-animation-frame-during-dom-mutation.html:
Added.
* Source/WebCore/dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks):
* Source/WebCore/html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::serviceRequestVideoFrameCallbacks):
Canonical link: https://commits.webkit.org/310666@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications