Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Navigation within iframe doesn't exit fullscreen for parent iframe el…
…ement https://bugs.webkit.org/show_bug.cgi?id=251896 rdar://104393093 Reviewed by Chris Dumez. This was because the exiting document was already detached from the Frame object, causing it to fail to find the top document. To fix this, we store the top document when initializing FullscreenManager. * LayoutTests/fullscreen/fullscreen-iframe-navigation-expected.html: Added. * LayoutTests/fullscreen/fullscreen-iframe-navigation.html: Added. * LayoutTests/fullscreen/resources/fullscreen-iframe-navigation-target.html: Added. * LayoutTests/platform/mac-wk1/TestExpectations: * Source/WebCore/dom/FullscreenManager.cpp: (WebCore::FullscreenManager::cancelFullscreen): (WebCore::documentsToUnfullscreen): (WebCore::FullscreenManager::exitFullscreen): (WebCore::FullscreenManager::finishExitFullscreen): (WebCore::FullscreenManager::didExitFullscreen): * Source/WebCore/dom/FullscreenManager.h: Canonical link: https://commits.webkit.org/260024@main
- Loading branch information
Showing
6 changed files
with
83 additions
and
14 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
LayoutTests/fullscreen/fullscreen-iframe-navigation-expected.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,7 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<meta charset="UTF-8"> | ||
<body> | ||
<iframe id="iframe" src="./resources/fullscreen-iframe-navigation-target.html"></iframe> | ||
</body> | ||
</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,42 @@ | ||
<!DOCTYPE html> | ||
<html class="reftest-wait"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<style> | ||
.failed { | ||
background-color: red; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<iframe id="iframe" srcdoc="<button onclick='document.documentElement.requestFullscreen().then(() => (window.location.href=`./resources/fullscreen-iframe-navigation-target.html`))'>Enter fullscreen and navigate</button>"></iframe> | ||
<script src="../imported/w3c/web-platform-tests/resources/testdriver.js"></script> | ||
<script src="../imported/w3c/web-platform-tests/resources/testdriver-vendor.js"></script> | ||
<script> | ||
addEventListener("load", async () => { | ||
await test_driver.bless("fullscreen", null, iframe.contentWindow); | ||
await new Promise(resolve => { | ||
addEventListener("fullscreenchange", resolve, { once: true }); | ||
iframe.contentDocument.documentElement.requestFullscreen(); | ||
}); | ||
if (!document.fullscreenElement) | ||
document.body.className = "failed"; | ||
await Promise.all([ | ||
new Promise(resolve => { | ||
addEventListener("message", (e) => { | ||
if (e.data == "loaded") | ||
resolve(); | ||
}, { once: true }); | ||
iframe.contentWindow.location.href = "./resources/fullscreen-iframe-navigation-target.html"; | ||
}), | ||
new Promise(resolve => { | ||
addEventListener("fullscreenchange", resolve, { once: true }); | ||
}) | ||
]); | ||
if (document.fullscreenElement) | ||
document.body.className = "failed"; | ||
document.documentElement.classList.remove("reftest-wait"); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
12 changes: 12 additions & 0 deletions
12
LayoutTests/fullscreen/resources/fullscreen-iframe-navigation-target.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,12 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<p>Successfully navigated, test passes if the iframe does not take the full content area size.</p> | ||
<script> | ||
addEventListener("DOMContentLoaded", () => { | ||
if (parent) | ||
parent.postMessage("loaded", "*"); | ||
}, { once: true }); | ||
</script> | ||
</body> | ||
</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
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