mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
112 lines
4.2 KiB
HTML
112 lines
4.2 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
|
-->
|
|
<head>
|
|
<title>Test for Bug 633602</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
|
Mozilla Bug 633602
|
|
</a>
|
|
<div id="content">
|
|
</div>
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
|
|
/**
|
|
* Pointer Lock tests for bug 633602. These depend on the fullscreen api
|
|
* which doesn't work when run in the mochitests' iframe, since the
|
|
* mochitests' iframe doesn't have an allowfullscreen attribute. To get
|
|
* around this, all tests are run in a child window, which can go fullscreen.
|
|
* This method is borrowed from content/html/content/test/test_fullscreen-api.html.
|
|
**/
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
// Ensure the full-screen api is enabled, and will be disabled on test exit.
|
|
SpecialPowers.setBoolPref("full-screen-api.enabled", true);
|
|
|
|
// Disable the requirement for trusted contexts only, so the tests are easier to write.
|
|
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
|
|
|
|
// Grant "fullscreen" permission on the test domain. This means fullscreen will be
|
|
// automatically approved, so pointer lock in the tests will be too.
|
|
SpecialPowers.setFullscreenAllowed(document);
|
|
|
|
// Run the tests which go full-screen in new window, as Mochitests
|
|
// normally run in an iframe, which by default will not have the
|
|
// allowfullscreen attribute set, so full-screen won't work.
|
|
var gTestFiles = [
|
|
"file_approval.html",
|
|
"file_screenClientXYConst.html",
|
|
"file_childIframe.html",
|
|
"file_doubleLock.html",
|
|
"file_escapeKey.html",
|
|
"file_infiniteMovement.html",
|
|
"file_locksvgelement.html",
|
|
"file_movementXY.html",
|
|
"file_nestedFullScreen.html",
|
|
"file_pointerlock-api.html",
|
|
"file_pointerlockerror.html",
|
|
"file_pointerLockPref.html",
|
|
"file_removedFromDOM.html",
|
|
"file_retargetMouseEvents.html",
|
|
"file_suppressSomeMouseEvents.html",
|
|
"file_targetOutOfFocus.html",
|
|
"file_withoutDOM.html",
|
|
"file_allowPointerLockSandboxFlag.html"
|
|
];
|
|
|
|
var gTestWindow = null;
|
|
var gTestIndex = 0;
|
|
|
|
// TODO: if ever we remove these checks for XP and Lion, we should do the same
|
|
// in content/html/content/test/test_fullscreen-api.html, which uses the same pattern.
|
|
const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
|
|
const isOSXLion = navigator.userAgent.indexOf("Mac OS X 10.7") != -1;
|
|
const isOSXMtnLion = navigator.userAgent.indexOf("Mac OS X 10.8") != -1;
|
|
|
|
function finish() {
|
|
SpecialPowers.clearUserPref("full-screen-api.enabled");
|
|
SpecialPowers.clearUserPref("full-screen-api.allow-trusted-requests-only");
|
|
SpecialPowers.removeFullscreenAllowed(document)
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
function nextTest() {
|
|
if (isWinXP) {
|
|
todo(false, "Can't reliably run full-screen tests on Windows XP due to bug 704010");
|
|
finish();
|
|
return;
|
|
}
|
|
if (isOSXLion || isOSXMtnLion) {
|
|
todo(false, "Can't reliably run full-screen tests on OS X Lion or Mountain Lion, see bug 744125");
|
|
finish();
|
|
return;
|
|
}
|
|
if (gTestWindow) {
|
|
gTestWindow.close();
|
|
}
|
|
SimpleTest.waitForFocus(runNextTest);
|
|
}
|
|
|
|
function runNextTest() {
|
|
if (gTestIndex < gTestFiles.length) {
|
|
gTestWindow = window.open(gTestFiles[gTestIndex], "", "width=500,height=500");
|
|
gTestIndex++;
|
|
} else {
|
|
finish();
|
|
}
|
|
}
|
|
|
|
addLoadEvent(nextTest);
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|