fune/dom/html/test/file_fullscreen-featurePolicy-inner.html
Emilio Cobos Álvarez e916b18fa8 Bug 1643798 - Fix feature policy check for fullscreen so that it gets reflected properly in document.fullscreenEnabled. r=baku
See bug 1606660 comment 8 as to why checking it only in
Element.requestFullscreen is wrong.

Do you know how to test this? I'm not very familiar with feature-policy.

Differential Revision: https://phabricator.services.mozilla.com/D78567
2020-06-25 13:17:04 +00:00

34 lines
1.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body onload="doRequestFullscreen()">
<script>
function doRequestFullscreen() {
let isChrome = location.search.includes("chrome");
function handler(evt) {
document.removeEventListener("fullscreenchange", handler);
document.removeEventListener("fullscreenerror", handler);
const enabled = isChrome ? SpecialPowers.wrap(document).fullscreenEnabled
: document.fullscreenEnabled;
if (evt.type == "fullscreenchange") {
document.addEventListener("fullscreenchange", () => parent.continueTest(evt.type, enabled), {once: true});
document.exitFullscreen();
} else {
parent.continueTest(evt.type, enabled);
}
}
document.addEventListener("fullscreenchange", handler);
document.addEventListener("fullscreenerror", handler);
parent.opener.info("Requesting fullscreen");
if (isChrome) {
SpecialPowers.wrap(document.documentElement).requestFullscreen();
} else {
document.documentElement.requestFullscreen();
}
}
</script>
</body>
</html>