Files
palemoon27/dom/tests/mochitest/pointerlock/test_pointerlock-api.html
T
roytam1 ebd6e6dc19 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1174323 - Disable screenClientXYConst subtest of pointerlock test on OS X. rs=KWierso (2d0db6d1b)
- Bug 992096 - Implement Sub Resource Integrity [1/2]. r=baku,r=ckerschb (c30671ac0)
- Bug 992096 - Implement Sub Resource Integrity [2/2]. r=ckerschb (0afc64d88)
- Bug 1091883 - Added test, this is fixed by a fix to bug 1113438. r=sstamm CLOSED TREE (fd9a64b43)
- Bug 1196740 - Consider redirects when looking for SRI-eligibility. r=ckerschb (5c749cdc9)
- Bug 1202015 - Better document the SRI strings for translators. r=ckerschb (a7860e0fb)
- Bug 1202027 - Make SRI require CORS loads for cross-origin resources. r=ckerschb (ea451323d)
- bit of Bug 1202902 - Mass replace toplevel 'let' with 'var' (a6e8a587d)
- Bug 1208629 - Properly support data: and blob: URIs with an integrity atribute. r=ckerschb (6b2018fe4)
- Bug 1140129 - Don't clear tab title when location changes (r=Mossop) (ca1945ba8)
- Bug 1073462: Send synthetic property with Content:LocationChange message. r=felipe (1aa418acf)
- bug 1165017 - annotate content process URL on location change. r=mconley (cdca4fa75)
- Bug 1157561 - Add webRequest-like API to Firefox (r=Mossop) (546a57822)
- Bug 1163861 - Include windowID in all WebRequest notifications (r=Mossop) (c140af560)
- Bug 1171248 - Add MatchPattern support to WebRequest module (r=Mossop) (b09a05658)
2021-08-17 10:04:53 +08:00

139 lines
5.1 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 dom/html/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 gDisableList = [
// Bug 1174323
{ file: "file_screenClientXYConst.html",
platform: "MacIntel" }
];
var gTestWindow = null;
var gTestIndex = 0;
// TODO: if ever we remove these checks for XP and Lion, we should do the same
// in dom/html/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;
const isOSXYosemite = navigator.userAgent.indexOf("Mac OS X 10.10") != -1;
const isWin8 = navigator.userAgent.indexOf("Windows NT 6.2") != -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 (isWin8) {
todo(false, "Can't reliably run full-screen + pointer lock tests on Windows 8");
finish();
return;
}
if (isOSXLion || isOSXMtnLion || isOSXYosemite) {
todo(false, "Can't reliably run full-screen tests on OS X Lion or Mountain Lion or Yosemite, see bug 744125");
finish();
return;
}
if (gTestWindow) {
gTestWindow.close();
}
SimpleTest.waitForFocus(runNextTest);
}
function runNextTest() {
if (gTestIndex < gTestFiles.length) {
var file = gTestFiles[gTestIndex];
gTestIndex++;
var skipTest = false;
for (var item of gDisableList) {
if (item.file == file && navigator.platform == item.platform) {
skipTest = true;
break;
}
}
if (!skipTest) {
info(`Testing ${file}`);
gTestWindow = window.open(file, "", "width=500,height=500");
} else {
nextTest();
}
} else {
finish();
}
}
addLoadEvent(nextTest);
</script>
</pre>
</body>
</html>