2011-12-07 01:59:39 +04:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=700764
|
|
|
|
|
|
|
|
Verifies that cancelFullScreen() rolls back to have the previous full-screen
|
|
|
|
element full-screen.
|
|
|
|
|
|
|
|
Tests:
|
|
|
|
* Request full-screen in doc.
|
|
|
|
* Request full-screen in doc on element not descended from full-screen element. Request should be denied.
|
|
|
|
* Request full-screen in subdoc.
|
|
|
|
* Cancel full-screen in subdoc, doc should be full-screen.
|
|
|
|
* Request full-screen in subdoc.
|
|
|
|
* Removing FSE should fully-exit full-screen.
|
|
|
|
|
|
|
|
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 700764</title>
|
2019-04-16 06:53:28 +03:00
|
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
2012-10-09 02:21:57 +04:00
|
|
|
<script type="application/javascript" src="file_fullscreen-utils.js"></script>
|
2011-12-07 01:59:39 +04:00
|
|
|
</head>
|
2012-03-21 03:21:15 +04:00
|
|
|
<body>
|
2011-12-07 01:59:39 +04:00
|
|
|
|
|
|
|
<div id="fse">
|
|
|
|
<div id="fse-inner">
|
2017-06-21 10:21:15 +03:00
|
|
|
<iframe id="subdoc" allowfullscreen srcdoc="<html><body bgcolor='black'></body></html>"></iframe>
|
2011-12-07 01:59:39 +04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="non-fse"></div>
|
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
/** Test for Bug 700764 **/
|
|
|
|
|
|
|
|
function ok(condition, msg) {
|
|
|
|
opener.ok(condition, "[rollback] " + msg);
|
2012-10-09 02:21:57 +04:00
|
|
|
if (!condition) {
|
|
|
|
opener.finish();
|
|
|
|
}
|
2011-12-07 01:59:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function is(a, b, msg) {
|
|
|
|
opener.is(a, b, "[rollback] " + msg);
|
2012-10-09 02:21:57 +04:00
|
|
|
if (a != b) {
|
|
|
|
opener.finish();
|
|
|
|
}
|
2011-12-07 01:59:39 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 02:21:57 +04:00
|
|
|
function enterFullscreen(element, callback) {
|
|
|
|
addFullscreenChangeContinuation("enter", callback);
|
|
|
|
element.focus();
|
2016-02-17 03:47:11 +03:00
|
|
|
element.requestFullscreen();
|
2011-12-07 01:59:39 +04:00
|
|
|
}
|
|
|
|
|
2012-10-09 02:21:57 +04:00
|
|
|
function revertFullscreen(doc, callback) {
|
2016-02-17 03:47:11 +03:00
|
|
|
ok(doc.fullscreenElement != null, "Should only exit fullscreen on a fullscreen doc");
|
2012-10-09 02:21:57 +04:00
|
|
|
addFullscreenChangeContinuation("exit", callback, doc);
|
2016-02-17 03:47:11 +03:00
|
|
|
doc.exitFullscreen();
|
2011-12-07 01:59:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function e(id) {
|
|
|
|
return document.getElementById(id);
|
|
|
|
}
|
|
|
|
|
2012-04-23 14:48:00 +04:00
|
|
|
function requestFullscreen(element) {
|
|
|
|
element.focus();
|
2016-02-17 03:47:11 +03:00
|
|
|
element.requestFullscreen();
|
2012-04-23 14:48:00 +04:00
|
|
|
}
|
|
|
|
|
2012-03-21 03:21:15 +04:00
|
|
|
function begin() {
|
2012-10-09 02:21:57 +04:00
|
|
|
enterFullscreen(e("fse"), change1);
|
2011-12-07 01:59:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function change1() {
|
2016-02-17 03:47:11 +03:00
|
|
|
is(document.fullscreenElement, e("fse"), "Body should be FSE");
|
2011-12-07 01:59:39 +04:00
|
|
|
// Request full-screen from element not descendent from current FSE.
|
2012-10-09 02:21:57 +04:00
|
|
|
addFullscreenErrorContinuation(error1);
|
2012-04-23 14:48:00 +04:00
|
|
|
requestFullscreen(e("non-fse"));
|
2011-12-07 01:59:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function error1() {
|
2016-02-17 03:47:11 +03:00
|
|
|
is(document.fullscreenElement, e("fse"), "FSE should not change");
|
2011-12-07 01:59:39 +04:00
|
|
|
var iframe = e("subdoc");
|
2012-10-09 02:21:57 +04:00
|
|
|
enterFullscreen(iframe.contentDocument.body, change2);
|
2011-12-07 01:59:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function change2() {
|
|
|
|
var iframe = e("subdoc");
|
2016-02-17 03:47:11 +03:00
|
|
|
is(document.fullscreenElement, iframe, "Subdoc container should be FSE.");
|
|
|
|
is(iframe.contentDocument.fullscreenElement, iframe.contentDocument.body, "Subdoc body should be FSE in subdoc");
|
2012-10-09 02:21:57 +04:00
|
|
|
revertFullscreen(document, change3);
|
2011-12-07 01:59:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function change3() {
|
2016-02-17 03:47:11 +03:00
|
|
|
is(document.fullscreenElement, e("fse"), "FSE should rollback to FSE.");
|
2012-10-09 02:21:57 +04:00
|
|
|
revertFullscreen(document, change4);
|
2011-12-07 01:59:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function change4() {
|
2016-02-17 03:47:11 +03:00
|
|
|
is(document.fullscreenElement, null, "Should have left full-screen entirely");
|
2012-10-09 02:21:57 +04:00
|
|
|
enterFullscreen(e("fse"), change5);
|
2011-12-07 01:59:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function change5() {
|
2016-02-17 03:47:11 +03:00
|
|
|
is(document.fullscreenElement, e("fse"), "FSE should be e('fse')");
|
2012-10-09 02:21:57 +04:00
|
|
|
enterFullscreen(e("fse-inner"), change6);
|
2011-12-07 01:59:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function change6() {
|
2012-10-09 02:21:57 +04:00
|
|
|
addFullscreenChangeContinuation("exit", change7);
|
2011-12-07 01:59:39 +04:00
|
|
|
var element = e('fse-inner');
|
2016-02-17 03:47:11 +03:00
|
|
|
is(document.fullscreenElement, element, "FSE should be e('fse-inner')");
|
2017-01-30 10:10:22 +03:00
|
|
|
element.remove();
|
2011-12-07 01:59:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function change7() {
|
2016-02-17 03:47:11 +03:00
|
|
|
is(document.fullscreenElement, null, "Should have fully exited full-screen mode when removed FSE from doc");
|
2011-12-07 01:59:39 +04:00
|
|
|
opener.nextTest();
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|