Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nullptr crash in EventPath::buildPath via FullscreenManager::dispatch…
…FullscreenChangeOrErrorEvent https://bugs.webkit.org/show_bug.cgi?id=242345 Reviewed by Chris Dumez. The bug was caused by EventPath::buildPath stumbling upon an element inside a shadow tree which had already been disassociated with its shadow host as a way of destruction. This doesn't ordinarily happen since the shadow host of a shadow root gets kept alive by its JS wrapper. The bug is precisely that FullscreenManager doesn't keep alive JS wrappers of nodes to dispatch change and error events. This patch addresses this problem by deploying GCReachableRef in FullscreenManager. * LayoutTests/fullscreen/full-screen-inside-shadow-event-path-crash-expected.txt: Added. * LayoutTests/fullscreen/full-screen-inside-shadow-event-path-crash.html: Added. * Source/WebCore/dom/FullscreenManager.cpp: (WebCore::FullscreenManager::dispatchFullscreenChangeEvents): (WebCore::FullscreenManager::dispatchFullscreenChangeOrErrorEvent): (WebCore::FullscreenManager::addDocumentToFullscreenChangeEventQueue): * Source/WebCore/dom/FullscreenManager.h: Canonical link: https://commits.webkit.org/253227@main
- Loading branch information
Showing
4 changed files
with
38 additions
and
17 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
LayoutTests/fullscreen/full-screen-inside-shadow-event-path-crash-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PASS |
22 changes: 22 additions & 0 deletions
22
LayoutTests/fullscreen/full-screen-inside-shadow-event-path-crash.html
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script> | ||
if (window.testRunner) { | ||
testRunner.waitUntilDone(); | ||
testRunner.dumpAsText(); | ||
} | ||
|
||
onload = async () => { | ||
let shadowRoot = document.createElement('div').attachShadow({mode: 'open'}); | ||
window.r = new WeakRef(shadowRoot.children); | ||
let div2 = document.createElement('div'); | ||
div2.webkitRequestFullscreen(); | ||
shadowRoot.replaceChildren(div2); | ||
await undefined; | ||
GCController.collect(); | ||
location.href = `data:text/html,<!DOCTYPE html> | ||
<p>PASS</p> | ||
<script> | ||
if (window.testRunner) | ||
testRunner.notifyDone(); | ||
</` + 'script>' | ||
}; | ||
</script> |
This file contains 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
This file contains 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