gecko-dev/dom/html/test/file_fullscreen-unprefix-disabled-inner.html
Brian Grinstead 0d460e3432 Bug 1544322 - Part 2.2 - Remove the [type] attribute for one-liner <script> tags loading files in /tests/SimpleTest/ in dom/ r=bzbarsky
This is split from the previous changeset since if we include dom/ the file size is too
large for phabricator to handle.

This is an autogenerated commit to handle scripts loading mochitest harness files, in
the simple case where the script src is on the same line as the tag.

This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170
using the `--part 2` argument.

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

--HG--
extra : moz-landing-system : lando
2019-04-16 03:53:28 +00:00

107 lines
3.6 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Test for Bug 1268749</title>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<style>
#fullscreen {
color: green;
}
#fullscreen:fullscreen {
color: red;
}
</style>
</head>
<body>
<div id="fullscreen"></div>
<script>
function ok(condition, msg) {
opener.opener.ok(condition, "[unprefix-disabled] " + msg);
}
function is(a, b, msg) {
opener.opener.is(a, b, "[unprefix-disabled] " + msg);
}
function info(msg) {
opener.opener.info("[unprefix-disabled] " + msg);
}
SimpleTest.requestFlakyTimeout(
"need to wait for a while to confirm no unexpected event is dispatched");
let div = document.getElementById("fullscreen");
let unattachedDiv = document.createElement('div');
function begin() {
ok(!("requestFullscreen" in div), "No element.requestFullscreen");
ok(!("exitFullscreen" in document), "No document.exitFullscreen");
ok(!("fullscreen" in document), "No document.fullscreen");
ok(!("fullscreenElement" in document), "No document.fullscreenElement");
ok(!("fullscreenEnabled" in document), "No document.fullscreenEnabled");
ok(!("onfullscreenchange" in document), "No document.onfullscreenchange");
ok(!("onfullscreenerror" in document), "No document.onfullscreenerror");
for (var event of ["fullscreenchange", "fullscreenerror"]) {
let customEvent = new Event(event, {bubbles: true});
let gotCustomEventFromWindow = false;
let gotCustomEventFromDocument = false;
let listenerForWindow = evt => {
ok(!gotCustomEventFromWindow,
"Should get custom event from window only once");
ok(evt == customEvent, "Should get the desired custom event");
gotCustomEventFromWindow = true;
};
let listenerForDocument = evt => {
ok(!gotCustomEventFromDocument,
"Should get custom event from document only once");
ok(evt == customEvent, "Should get the desired custom event");
gotCustomEventFromDocument = true;
};
window.addEventListener(event, listenerForWindow);
document.addEventListener(event, listenerForDocument);
document.dispatchEvent(customEvent);
ok(gotCustomEventFromWindow, "Should get the custom event from window");
ok(gotCustomEventFromDocument, "Should get the custom event from document");
window.removeEventListener(event, listenerForWindow);
document.removeEventListener(event, listenerForDocument);
for (var target of [window, document]) {
target.addEventListener(event, () => {
ok(false, `No ${event} should be triggered on ${target}`);
});
}
}
document.addEventListener("mozfullscreenchange", enteredFullscreen);
SimpleTest.executeSoon(() => div.mozRequestFullScreen());
}
function enteredFullscreen() {
document.removeEventListener("mozfullscreenchange", enteredFullscreen);
is(getComputedStyle(div).color, "rgb(0, 128, 0)",
":fullscreen should not apply");
document.addEventListener("mozfullscreenchange", exitedFullscreen);
SimpleTest.executeSoon(() => document.mozCancelFullScreen());
}
function exitedFullscreen() {
document.removeEventListener("mozfullscreenchange", exitedFullscreen);
document.addEventListener("mozfullscreenerror", errorFullscreen);
SimpleTest.executeSoon(() => unattachedDiv.mozRequestFullScreen());
}
function errorFullscreen() {
document.removeEventListener("mozfullscreenerror", errorFullscreen);
// Wait a short time before exiting this test to confirm that there is
// really no unwanted event gets dispatched.
setTimeout(() => opener.finish(), 200);
}
</script>
</body>
</html>