diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/html/test/file_fullscreen-unprefix-disabled-inner.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/html/test/file_fullscreen-unprefix-disabled-inner.html')
-rw-r--r-- | dom/html/test/file_fullscreen-unprefix-disabled-inner.html | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/dom/html/test/file_fullscreen-unprefix-disabled-inner.html b/dom/html/test/file_fullscreen-unprefix-disabled-inner.html new file mode 100644 index 000000000..632a6c0ce --- /dev/null +++ b/dom/html/test/file_fullscreen-unprefix-disabled-inner.html @@ -0,0 +1,96 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="UTF-8"> + <title>Test for Bug 1268749</title> + <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> +</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); + 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> |