Bug 1609180 - Add test for requesting fullscreen from parent window; r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D62669

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Edgar Chen 2020-02-13 21:44:07 +00:00
Родитель db39fa490d
Коммит e8322fa0ba
3 изменённых файлов: 55 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,53 @@
<!DOCTYPE html>
<title>Test for Bug 1609180</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script src="file_fullscreen-utils.js"></script>
<style>
</style>
<button>Request Fullscreen on sub iframe</button>
<iframe src="dummy_page.html" allowfullscreen></iframe>
<script>
function ok(condition, msg) {
opener.ok(condition, "[sub-iframe] " + msg);
}
function is(a, b, msg) {
opener.is(a, b, "[sub-iframe] " + msg);
}
function begin() {
SpecialPowers.pushPrefEnv({
"set":[["full-screen-api.allow-trusted-requests-only", true]]
}, startTest);
}
let doc;
function startTest() {
let button = document.querySelector("button");
doc = document.querySelector("iframe").contentDocument;
button.addEventListener("click", () => {
doc.documentElement.requestFullscreen();
});
addFullscreenChangeContinuation("enter", enteredFullscreen, doc);
addFullscreenErrorContinuation(() => {
ok(false, "Failed to enter fullscreen");
exitedFullscreen();
}, doc);
synthesizeMouseAtCenter(button, {});
}
function enteredFullscreen() {
is(doc.fullscreenElement, doc.documentElement, "Entered fullscreen");
addFullscreenChangeContinuation("exit", exitedFullscreen, doc);
doc.exitFullscreen();
}
function exitedFullscreen() {
SpecialPowers.popPrefEnv(finish);
}
function finish() {
opener.nextTest();
}
</script>

Просмотреть файл

@ -464,6 +464,7 @@ support-files =
file_fullscreen-scrollbar.html
file_fullscreen-selector.html
file_fullscreen-shadowdom.html
file_fullscreen-sub-iframe.html
file_fullscreen-svg-element.html
file_fullscreen-table.html
file_fullscreen-top-layer.html

Просмотреть файл

@ -53,6 +53,7 @@ var gTestWindows = [
["dom.security.featurePolicy.header.enabled", true],
["dom.security.featurePolicy.webidl.enabled", true]] },
{ test: "file_fullscreen-async.html" },
{ test: "file_fullscreen-sub-iframe.html" },
];
var testWindow = null;