2011-11-01 05:11:47 +00:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 545812</title>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
background-color: black;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=545812">Mozilla Bug 545812</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
/** Tests for Bug 545812 **/
|
2014-12-11 18:34:40 +00:00
|
|
|
SimpleTest.requestFlakyTimeout("untriaged");
|
|
|
|
|
2011-11-01 05:11:47 +00:00
|
|
|
// Run the tests which go full-screen in new windows, as mochitests normally
|
2012-10-29 22:02:24 +00:00
|
|
|
// run in an iframe, which by default will not have the allowfullscreen
|
2011-11-01 05:11:47 +00:00
|
|
|
// attribute set, so full-screen won't work.
|
|
|
|
var gTestWindows = [
|
2013-02-26 05:40:53 +00:00
|
|
|
"file_fullscreen-multiple.html",
|
2011-12-06 21:59:39 +00:00
|
|
|
"file_fullscreen-rollback.html",
|
2011-11-14 20:33:37 +00:00
|
|
|
"file_fullscreen-esc-exit.html",
|
2011-11-01 05:11:47 +00:00
|
|
|
"file_fullscreen-denied.html",
|
|
|
|
"file_fullscreen-api.html",
|
2017-10-20 17:32:30 +00:00
|
|
|
"file_fullscreen-plugins.html",
|
2011-11-04 07:30:09 +00:00
|
|
|
"file_fullscreen-hidden.html",
|
2012-03-24 04:37:04 +00:00
|
|
|
"file_fullscreen-svg-element.html",
|
2015-08-29 03:53:28 +00:00
|
|
|
"file_fullscreen-navigation.html",
|
2015-09-30 00:48:41 +00:00
|
|
|
"file_fullscreen-scrollbar.html",
|
2015-10-07 03:04:32 +00:00
|
|
|
"file_fullscreen-selector.html",
|
2018-02-13 16:57:32 +00:00
|
|
|
"file_fullscreen-shadowdom.html",
|
2015-10-08 06:47:39 +00:00
|
|
|
"file_fullscreen-top-layer.html",
|
2016-01-27 23:11:00 +00:00
|
|
|
"file_fullscreen-backdrop.html",
|
2015-10-08 06:47:39 +00:00
|
|
|
"file_fullscreen-nested.html",
|
2016-02-17 00:47:11 +00:00
|
|
|
"file_fullscreen-prefixed.html",
|
2016-05-02 05:36:53 +00:00
|
|
|
"file_fullscreen-unprefix-disabled.html",
|
2016-05-12 00:28:56 +00:00
|
|
|
"file_fullscreen-lenient-setters.html",
|
2016-11-22 05:31:56 +00:00
|
|
|
"file_fullscreen-table.html",
|
2011-11-01 05:11:47 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
var testWindow = null;
|
|
|
|
var gTestIndex = 0;
|
|
|
|
|
2015-05-20 21:52:26 +00:00
|
|
|
function finish() {
|
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
2011-11-01 05:11:47 +00:00
|
|
|
function nextTest() {
|
|
|
|
if (testWindow) {
|
|
|
|
testWindow.close();
|
|
|
|
}
|
2015-08-29 03:53:28 +00:00
|
|
|
SimpleTest.executeSoon(runNextTest);
|
2012-03-20 23:21:15 +00:00
|
|
|
}
|
|
|
|
|
2017-04-07 19:40:27 +00:00
|
|
|
var gLinuxE10sSkipList = [
|
|
|
|
{ "test": "file_fullscreen-plugins.html", "reason": "bug 1330553" },
|
|
|
|
{ "test": "file_fullscreen-api.html", "reason": "bug 1332040" },
|
|
|
|
{ "test": "file_fullscreen-scrollbar.html", "reason": "bug 1350875" }
|
|
|
|
];
|
|
|
|
|
2017-02-08 03:42:06 +00:00
|
|
|
function shouldSkipTest(test) {
|
2017-10-11 21:11:22 +00:00
|
|
|
if (SpecialPowers.Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).isHeadless &&
|
|
|
|
test == "file_fullscreen-plugins.html") {
|
|
|
|
todo(false, `${test} skipped due to bug 1409805`);
|
|
|
|
return true;
|
|
|
|
}
|
2018-02-25 18:37:54 +00:00
|
|
|
|
|
|
|
if (!SpecialPowers.DOMWindowUtils.isStyledByServo &&
|
|
|
|
test == "file_fullscreen-shadowdom.html") {
|
|
|
|
// Shadow DOM is stylo-only.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-04-07 19:40:27 +00:00
|
|
|
if (!SpecialPowers.isMainProcess() &&
|
2018-02-01 19:45:22 +00:00
|
|
|
navigator.platform.includes('Linux')) {
|
2017-04-07 19:40:27 +00:00
|
|
|
for (let item of gLinuxE10sSkipList) {
|
|
|
|
if (item.test == test) {
|
|
|
|
todo(false, `${test} skipped due to ${item.reason}`);
|
|
|
|
return true;
|
|
|
|
}
|
2017-02-08 03:42:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-06-05 06:56:00 +00:00
|
|
|
function waitForEvent(eventTarget, eventName, checkFn, callback) {
|
|
|
|
eventTarget.addEventListener(eventName, function listener(event) {
|
|
|
|
if (checkFn && !checkFn(event)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
eventTarget.removeEventListener(eventName, listener);
|
|
|
|
callback();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-03-20 23:21:15 +00:00
|
|
|
function runNextTest() {
|
2011-11-01 05:11:47 +00:00
|
|
|
if (gTestIndex < gTestWindows.length) {
|
2017-02-08 03:42:06 +00:00
|
|
|
let test = gTestWindows[gTestIndex];
|
|
|
|
if (shouldSkipTest(test)) {
|
|
|
|
info(`Skip test ${test}`);
|
|
|
|
SimpleTest.executeSoon(runNextTest);
|
|
|
|
} else {
|
|
|
|
info(`Run test ${test}`);
|
|
|
|
testWindow = window.open(test, "", "width=500,height=500,scrollbars=yes");
|
|
|
|
// We'll wait for the window to load, then make sure our window is refocused
|
|
|
|
// before starting the test, which will get kicked off on "focus".
|
|
|
|
// This ensures that we're essentially back on the primary "desktop" on
|
|
|
|
// OS X Lion before we run the test.
|
|
|
|
testWindow.addEventListener("load", function() {
|
|
|
|
SimpleTest.waitForFocus(function() {
|
2017-06-05 06:56:00 +00:00
|
|
|
SimpleTest.waitForFocus(function() {
|
|
|
|
// For the platforms that support reporting occlusion state (e.g. Mac),
|
|
|
|
// we should wait until the docshell has been activated again,
|
|
|
|
// otherwise, the fullscreen request might be denied.
|
|
|
|
if (testWindow.document.hidden) {
|
|
|
|
waitForEvent(testWindow.document, "visibilitychange", (event) => {
|
|
|
|
return !testWindow.document.hidden;
|
|
|
|
}, testWindow.begin);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
testWindow.begin();
|
|
|
|
}, testWindow);
|
2017-02-08 03:42:06 +00:00
|
|
|
});
|
|
|
|
}, {once: true});
|
|
|
|
}
|
2011-11-01 05:11:47 +00:00
|
|
|
gTestIndex++;
|
|
|
|
} else {
|
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-08 22:00:33 +00:00
|
|
|
try {
|
|
|
|
window.fullScreen = true;
|
|
|
|
} catch (e) {
|
2013-03-14 23:49:25 +00:00
|
|
|
}
|
2015-07-08 22:00:33 +00:00
|
|
|
is(window.fullScreen, false, "Shouldn't be able to set window fullscreen from content");
|
|
|
|
// Ensure the full-screen api is enabled, and will be disabled on test exit.
|
|
|
|
// Disable the requirement for trusted contexts only, so the tests are easier
|
|
|
|
// to write
|
|
|
|
addLoadEvent(function() {
|
|
|
|
SpecialPowers.pushPrefEnv({
|
2015-07-13 10:44:36 +00:00
|
|
|
"set": [
|
|
|
|
["full-screen-api.enabled", true],
|
2016-05-02 04:14:36 +00:00
|
|
|
["full-screen-api.unprefix.enabled", true],
|
2015-07-13 10:44:36 +00:00
|
|
|
["full-screen-api.allow-trusted-requests-only", false],
|
|
|
|
["full-screen-api.transition-duration.enter", "0 0"],
|
2018-02-13 16:57:32 +00:00
|
|
|
["full-screen-api.transition-duration.leave", "0 0"],
|
|
|
|
["dom.webcomponents.shadowdom.enabled", true]
|
2015-07-13 10:44:36 +00:00
|
|
|
]}, nextTest);
|
2015-07-08 22:00:33 +00:00
|
|
|
});
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2011-11-01 05:11:47 +00:00
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|