зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 4 changesets (bug 931445) for e10s mochitest failures
Backed out changeset 5a92875424b0 Backed out changeset 79ba5815f9aa Backed out changeset b084784405ef Backed out changeset 67bf9ee17564 --HG-- extra : rebase_source : 9604d138e1d333d7bcf6edc8b886340b8371524d
This commit is contained in:
Родитель
ee5595f78a
Коммит
adf9f94c38
|
@ -4401,9 +4401,6 @@ EventStateManager::SetPointerLock(nsIWidget* aWidget,
|
|||
// pre-pointerlock position, so that the synthetic mouse event reports
|
||||
// no movement.
|
||||
sLastRefPoint = mPreLockPoint;
|
||||
// Reset SynthCenteringPoint to invalid so that next time we start
|
||||
// locking pointer, it has its initial value.
|
||||
sSynthCenteringPoint = kInvalidRefPoint;
|
||||
if (aWidget) {
|
||||
aWidget->SynthesizeNativeMouseMove(
|
||||
mPreLockPoint + aWidget->WidgetToScreenOffset(), nullptr);
|
||||
|
|
|
@ -108,10 +108,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
|||
secondMove.mozMovementY = e.mozMovementY;
|
||||
parent.removeEventListener("mousemove", secondMoveChild);
|
||||
|
||||
addFullscreenChangeContinuation("exit", function() {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
document.exitFullscreen();
|
||||
};
|
||||
|
||||
|
@ -122,10 +118,21 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
|||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
addFullscreenChangeContinuation("enter", function() {
|
||||
document.addEventListener("mozpointerlockerror", function () {
|
||||
document.exitFullscreen();
|
||||
}, false);
|
||||
|
||||
document.addEventListener("fullscreenchange", function (e) {
|
||||
if (document.fullscreenElement === parent) {
|
||||
parent.mozRequestPointerLock();
|
||||
});
|
||||
}
|
||||
else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
parent.requestFullscreen();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -40,10 +40,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
|||
document.addEventListener("mozpointerlockchange", function (e) {
|
||||
if (document.mozPointerLockElement === div) {
|
||||
if (numberOfLocks === 2) {
|
||||
addFullscreenChangeContinuation("exit", function() {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
document.exitFullscreen();
|
||||
}
|
||||
else {
|
||||
|
@ -53,11 +49,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
|||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("fullscreenchange", function (e) {
|
||||
if (document.fullscreenElement === div) {
|
||||
div.mozRequestPointerLock();
|
||||
}
|
||||
else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
console.log('started');
|
||||
addFullscreenChangeContinuation("enter", function() {
|
||||
div.mozRequestPointerLock();
|
||||
});
|
||||
div.requestFullscreen();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -29,11 +29,12 @@
|
|||
, pointerUnLocked = false;
|
||||
|
||||
function start() {
|
||||
addFullscreenChangeContinuation("enter", enteredFullscreen);
|
||||
document.addEventListener("fullscreenchange", enteredFullscreen);
|
||||
div.requestFullscreen();
|
||||
}
|
||||
|
||||
function enteredFullscreen(e) {
|
||||
document.removeEventListener("fullscreenchange", enteredFullscreen);
|
||||
is(document.fullscreenElement, div, "Element #div should entered fullscreen");
|
||||
ok(!document.mozPointerLockElement, "Pointer shouldn't have been locked");
|
||||
document.addEventListener("mozpointerlockchange", lockedPointer);
|
||||
|
@ -44,7 +45,7 @@
|
|||
document.removeEventListener("mozpointerlockchange", lockedPointer);
|
||||
is(document.mozPointerLockElement, div, "Pointer should have been locked on #div");
|
||||
document.addEventListener("mozpointerlockchange", unlockedPointer);
|
||||
addFullscreenChangeContinuation("exit", leavedFullscreen);
|
||||
document.addEventListener("fullscreenchange", leavedFullscreen);
|
||||
SimpleTest.executeSoon(() => synthesizeKey("VK_ESCAPE", {}));
|
||||
}
|
||||
|
||||
|
@ -60,6 +61,7 @@
|
|||
}
|
||||
|
||||
function leavedFullscreen() {
|
||||
document.removeEventListener("fullscreenchange", leavedFullscreen);
|
||||
ok(!exitedFullscreen, "Shouldn't have exited fullscreen before");
|
||||
ok(!document.fullscreenElement, "Should have exited fullscreen now");
|
||||
exitedFullscreen = true;
|
||||
|
|
|
@ -65,11 +65,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
|||
totalMovementY = divCenterHeight + ((divCenterHeight / 2) * 3);
|
||||
|
||||
div.removeEventListener("mousemove", secondMoveListener, false);
|
||||
addFullscreenChangeContinuation("exit", function() {
|
||||
info("Got fullscreenchange for exiting");
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
document.exitFullscreen();
|
||||
}
|
||||
|
||||
|
@ -89,12 +84,20 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
|||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
info("Requesting fullscreen on parent");
|
||||
addFullscreenChangeContinuation("enter", function() {
|
||||
document.addEventListener("fullscreenchange", function() {
|
||||
if (document.fullscreenElement === div) {
|
||||
info("Got fullscreenchange for entering");
|
||||
div.mozRequestPointerLock();
|
||||
});
|
||||
}
|
||||
else {
|
||||
info("Got fullscreenchange for exiting");
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
info("Requesting fullscreen on parent");
|
||||
div.requestFullscreen();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -41,19 +41,21 @@
|
|||
elemWasLocked = true;
|
||||
document.mozExitPointerLock();
|
||||
} else {
|
||||
addFullscreenChangeContinuation("exit", function() {
|
||||
ok(elemWasLocked, "Expected SVG elem to become locked.");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
document.exitFullscreen();
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("fullscreenchange", function (e) {
|
||||
if (document.fullscreenElement === elem) {
|
||||
elem.mozRequestPointerLock();
|
||||
} else {
|
||||
ok(elemWasLocked, "Expected SVG elem to become locked.");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
elem = document.getElementById("svg-elem");
|
||||
addFullscreenChangeContinuation("enter", function() {
|
||||
elem.mozRequestPointerLock();
|
||||
});
|
||||
elem.requestFullscreen();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -83,21 +83,35 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
|||
secondMove.mozMovementY = e.mozMovementY;
|
||||
|
||||
div.removeEventListener("mousemove", moveMouseAgain, false);
|
||||
addFullscreenChangeContinuation("exit", function() {
|
||||
info("Got fullscreenchange for exiting");
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
document.exitFullscreen();
|
||||
};
|
||||
|
||||
function start() {
|
||||
info("Requesting fullscreen on parent");
|
||||
addFullscreenChangeContinuation("enter", function() {
|
||||
function fullscreenchange() {
|
||||
if (document.fullscreenElement === div) {
|
||||
info("Got fullscreenchange for entering");
|
||||
var screenX = window.screenX;
|
||||
var screenY = window.screenY;
|
||||
if (screenX != 0 || screenY != 0) {
|
||||
todo(screenX == 0 && screenY == 0,
|
||||
"We should only receive fullscreenchange once we've finished fullscreen transition");
|
||||
setTimeout(fullscreenchange, 250);
|
||||
return;
|
||||
}
|
||||
info("Finish waiting for fullscreenchange");
|
||||
div.addEventListener("mousemove", moveMouse, false);
|
||||
synthesizeMouseAtCenter(div, {type: "mousemove"}, window);
|
||||
});
|
||||
}
|
||||
else {
|
||||
info("Got fullscreenchange for exiting");
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("fullscreenchange", fullscreenchange, false);
|
||||
|
||||
function start() {
|
||||
info("Requesting fullscreen on parent");
|
||||
div.requestFullscreen();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -49,26 +49,30 @@
|
|||
document.addEventListener("mozpointerlockchange", function (e) {
|
||||
if (document.mozPointerLockElement === parentDiv) {
|
||||
parentDivLocked = true;
|
||||
addFullscreenChangeContinuation("enter", function() {
|
||||
pointerLocked = !!document.mozPointerLockElement;
|
||||
addFullscreenChangeContinuation("exit", function() {
|
||||
addFullscreenChangeContinuation("exit", function() {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
document.exitFullscreen();
|
||||
});
|
||||
document.exitFullscreen();
|
||||
});
|
||||
childDiv.requestFullscreen();
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("fullscreenchange", function() {
|
||||
if (document.fullscreenElement === parentDiv) {
|
||||
if (parentDivFullScreen === true) {
|
||||
document.exitFullscreen();
|
||||
} else {
|
||||
parentDivFullScreen = true;
|
||||
parentDiv.mozRequestPointerLock();
|
||||
}
|
||||
}
|
||||
else if (document.fullscreenElement === childDiv) {
|
||||
pointerLocked = !!document.mozPointerLockElement;
|
||||
document.exitFullscreen();
|
||||
}
|
||||
else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
addFullscreenChangeContinuation("enter", function() {
|
||||
parentDivFullScreen = true;
|
||||
parentDiv.mozRequestPointerLock();
|
||||
});
|
||||
parentDiv.requestFullscreen();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -52,21 +52,24 @@
|
|||
|
||||
document.addEventListener("mozpointerlockerror", function (e) {
|
||||
prefDisabled = true;
|
||||
addFullscreenChangeContinuation("exit", function() {
|
||||
document.exitFullscreen();
|
||||
}, false);
|
||||
|
||||
document.addEventListener("fullscreenchange", function (e) {
|
||||
if (document.fullscreenElement === div) {
|
||||
SpecialPowers.setBoolPref("full-screen-api.pointer-lock.enabled",
|
||||
true );
|
||||
div.mozRequestPointerLock();
|
||||
}
|
||||
else {
|
||||
SpecialPowers.setBoolPref("full-screen-api.pointer-lock.enabled",
|
||||
true );
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
document.exitFullscreen();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
addFullscreenChangeContinuation("enter", function() {
|
||||
SpecialPowers.setBoolPref("full-screen-api.pointer-lock.enabled",
|
||||
true );
|
||||
div.mozRequestPointerLock();
|
||||
});
|
||||
div.requestFullscreen();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -79,23 +79,25 @@
|
|||
} else {
|
||||
info("Got mozpointerlockchange for exiting");
|
||||
pointerUnlocked = true;
|
||||
addFullscreenChangeContinuation("exit", function() {
|
||||
info("Got fullscreenchange for exiting");
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
document.exitFullscreen();
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("fullscreenchange", function(e) {
|
||||
if (document.fullscreenElement === div) {
|
||||
info("Got fullscreenchange for entering");
|
||||
hasRequestPointerLock = "mozRequestPointerLock" in div;
|
||||
div.mozRequestPointerLock();
|
||||
} else {
|
||||
info("Got fullscreenchange for exiting");
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
div = document.getElementById("div");
|
||||
info("Requesting fullscreen on parent");
|
||||
addFullscreenChangeContinuation("enter", function() {
|
||||
info("Got fullscreenchange for entering");
|
||||
hasRequestPointerLock = "mozRequestPointerLock" in div;
|
||||
div.mozRequestPointerLock();
|
||||
});
|
||||
div.requestFullscreen();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -51,7 +51,7 @@ function checkPointerLockElement(elem) {
|
|||
}
|
||||
|
||||
function start() {
|
||||
addFullscreenChangeContinuation("enter", enteredFullscreen);
|
||||
listenOneDocEvent("fullscreenchange", enteredFullscreen);
|
||||
document.documentElement.requestFullscreen();
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ function lockedPointerOnInner() {
|
|||
|
||||
function unlockedPointerFromInner() {
|
||||
checkPointerLockElement(null);
|
||||
addFullscreenChangeContinuation("exit", exitedFullscreen);
|
||||
listenOneDocEvent("fullscreenchange", exitedFullscreen);
|
||||
document.exitFullscreen();
|
||||
}
|
||||
|
||||
|
|
|
@ -171,11 +171,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
|||
child.removeEventListener("mousemove", childMoveTest);
|
||||
SimpleTest.executeSoon(function () {
|
||||
info("Exit fullscreen");
|
||||
addFullscreenChangeContinuation("exit", function() {
|
||||
info("Got fullscreenchange for exiting");
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
document.exitFullscreen();
|
||||
});
|
||||
}
|
||||
|
@ -193,12 +188,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
|||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
info("Requesting fullscreen on parent");
|
||||
addFullscreenChangeContinuation("enter", function() {
|
||||
document.addEventListener("fullscreenchange", function (e) {
|
||||
if (document.fullscreenElement === parent) {
|
||||
info("Got fullscreenchange for entering");
|
||||
parent.mozRequestPointerLock();
|
||||
});
|
||||
} else {
|
||||
info("Got fullscreenchange for exiting");
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
info("Requesting fullscreen on parent");
|
||||
parent.requestFullscreen();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -82,11 +82,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
|||
clientY: e.clientY
|
||||
};
|
||||
|
||||
addFullscreenChangeContinuation("exit", function() {
|
||||
info("Got fullscreenchange for exiting");
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
document.exitFullscreen();
|
||||
}
|
||||
|
||||
|
@ -103,17 +98,35 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
|||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
div = document.getElementById("div");
|
||||
info("Requesting fullscreen on parent");
|
||||
addFullscreenChangeContinuation("enter", function() {
|
||||
function fullscreenchange() {
|
||||
var screenX = window.screenX;
|
||||
var screenY = window.screenY;
|
||||
if (document.fullscreenElement === div) {
|
||||
info("Got fullscreenchange for entering");
|
||||
if (screenX != 0 || screenY != 0) {
|
||||
todo(screenX == 0 && screenY == 0,
|
||||
"We should only receive fullscreenchange once we've finished fullscreen transition " +
|
||||
"window.screenX=" + screenX + " window.screenY=" + screenY);
|
||||
setTimeout(fullscreenchange, 250);
|
||||
return;
|
||||
}
|
||||
info("Finish waiting for fullscreenchange");
|
||||
synthesizeNativeMouseMove(div, 0, 0, () => {
|
||||
div.addEventListener("mousemove", moveUnlocked, false);
|
||||
divRect = div.getBoundingClientRect();
|
||||
synthesizeNativeMouseMove(div, divRect.width / 2, divRect.height / 2);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
info("Got fullscreenchange for exiting");
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
document.addEventListener("fullscreenchange", fullscreenchange, false);
|
||||
|
||||
function start() {
|
||||
div = document.getElementById("div");
|
||||
info("Requesting fullscreen on parent");
|
||||
div.requestFullscreen();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -137,20 +137,23 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
|||
synthesizeMouseAtCenter(child, { type: "mousemove" }, window);
|
||||
}
|
||||
else {
|
||||
addFullscreenChangeContinuation("exit", function() {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
document.exitFullscreen();
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("fullscreenchange", function() {
|
||||
if (document.fullscreenElement === parent) {
|
||||
parent.mozRequestPointerLock();
|
||||
}
|
||||
else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
parent = document.getElementById("parent");
|
||||
child = document.getElementById("child");
|
||||
addFullscreenChangeContinuation("enter", function() {
|
||||
parent.mozRequestPointerLock();
|
||||
});
|
||||
parent.requestFullscreen();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -48,18 +48,20 @@
|
|||
document.addEventListener("mozpointerlockchange", function (e) {
|
||||
if (document.mozPointerLockElement === div) {
|
||||
divPointerLock = true;
|
||||
addFullscreenChangeContinuation("exit", function() {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
document.exitFullscreen();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
addFullscreenChangeContinuation("enter", function() {
|
||||
document.addEventListener("fullscreenchange", function() {
|
||||
if (document.fullscreenElement === div) {
|
||||
input.focus();
|
||||
});
|
||||
} else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
div.requestFullscreen();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -22,4 +22,4 @@ support-files =
|
|||
|
||||
[test_pointerlock-api.html]
|
||||
tags = fullscreen
|
||||
skip-if = buildapp == 'b2g' || toolkit == 'android' || os == 'win' # B2G - window.open focus issues using fullscreen. Win: Bug 931445
|
||||
skip-if = buildapp == 'b2g' || toolkit == 'android' || os == 'linux' || os == 'win' # B2G - window.open focus issues using fullscreen. Linux/Win: Bug 931445
|
||||
|
|
|
@ -1,46 +1,62 @@
|
|||
// Get test filename for page being run in popup so errors are more useful
|
||||
var testName = location.pathname.split('/').pop();
|
||||
const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
|
||||
const isOSXLion = navigator.userAgent.indexOf("Mac OS X 10.7") != -1;
|
||||
|
||||
// Wrap test functions and pass to parent window
|
||||
window.ok = function(a, msg) {
|
||||
opener.ok(a, testName + ": " + msg);
|
||||
};
|
||||
// If we're running in a child window, shim things so it works the same
|
||||
// as if we were running stand-alone.
|
||||
if (window.opener) {
|
||||
// Get test filename for page being run in popup so errors are more useful
|
||||
var testName = location.pathname.split('/').pop();
|
||||
|
||||
window.is = function(a, b, msg) {
|
||||
opener.is(a, b, testName + ": " + msg);
|
||||
};
|
||||
// Wrap test functions and pass to parent window
|
||||
window.ok = function(a, msg) {
|
||||
opener.ok(a, testName + ": " + msg);
|
||||
};
|
||||
|
||||
window.isnot = function(a, b, msg) {
|
||||
opener.isnot(a, b, testName + ": " + msg);
|
||||
};
|
||||
window.is = function(a, b, msg) {
|
||||
opener.is(a, b, testName + ": " + msg);
|
||||
};
|
||||
|
||||
window.todo = function(a, msg) {
|
||||
opener.todo(a, testName + ": " + msg);
|
||||
};
|
||||
window.isnot = function(a, b, msg) {
|
||||
opener.isnot(a, b, testName + ": " + msg);
|
||||
};
|
||||
|
||||
window.todo_is = function(a, b, msg) {
|
||||
opener.todo_is(a, b, testName + ": " + msg);
|
||||
};
|
||||
window.todo = function(a, msg) {
|
||||
opener.todo(a, testName + ": " + msg);
|
||||
};
|
||||
|
||||
window.todo_isnot = function(a, b, msg) {
|
||||
opener.todo_isnot(a, b, testName + ": " + msg);
|
||||
};
|
||||
window.todo_is = function(a, b, msg) {
|
||||
opener.todo_is(a, b, testName + ": " + msg);
|
||||
};
|
||||
|
||||
window.info = function(msg) {
|
||||
opener.info(testName + ": " + msg);
|
||||
};
|
||||
window.todo_isnot = function(a, b, msg) {
|
||||
opener.todo_isnot(a, b, testName + ": " + msg);
|
||||
};
|
||||
|
||||
// Override bits of SimpleTest so test files work stand-alone
|
||||
var SimpleTest = SimpleTest || {};
|
||||
window.info = function(msg) {
|
||||
opener.info(testName + ": " + msg);
|
||||
};
|
||||
|
||||
SimpleTest.waitForExplicitFinish = function() {
|
||||
dump("[POINTERLOCK] Starting " + testName+ "\n");
|
||||
};
|
||||
// Override bits of SimpleTest so test files work stand-alone
|
||||
var SimpleTest = SimpleTest || {};
|
||||
|
||||
SimpleTest.finish = function () {
|
||||
dump("[POINTERLOCK] Finishing " + testName+ "\n");
|
||||
opener.nextTest();
|
||||
};
|
||||
SimpleTest.waitForExplicitFinish = function() {
|
||||
dump("[POINTERLOCK] Starting " + testName+ "\n");
|
||||
};
|
||||
|
||||
SimpleTest.finish = function () {
|
||||
dump("[POINTERLOCK] Finishing " + testName+ "\n");
|
||||
opener.nextTest();
|
||||
};
|
||||
} else {
|
||||
// If we're not running in a child window, prefs need to get flipped here,
|
||||
// otherwise it was already done in the test runner parent.
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
addLoadEvent(function() {
|
||||
if (typeof start !== 'undefined') {
|
||||
|
@ -48,73 +64,3 @@ addLoadEvent(function() {
|
|||
}
|
||||
});
|
||||
|
||||
// Returns true if the window occupies the entire screen.
|
||||
// Note this only returns true once the transition from normal to
|
||||
// fullscreen mode is complete.
|
||||
function inFullscreenMode(win) {
|
||||
return win.innerWidth == win.screen.width &&
|
||||
win.innerHeight == win.screen.height;
|
||||
}
|
||||
|
||||
// Returns true if the window is in normal mode, i.e. non fullscreen mode.
|
||||
// Note this only returns true once the transition from fullscreen back to
|
||||
// normal mode is complete.
|
||||
function inNormalMode(win) {
|
||||
return win.innerWidth == win.normalSize.w &&
|
||||
win.innerHeight == win.normalSize.h;
|
||||
}
|
||||
|
||||
// Adds a listener that will be called once a fullscreen transition
|
||||
// is complete. When type==='enter', callback is called when we've
|
||||
// received a fullscreenchange event, and the fullscreen transition is
|
||||
// complete. When type==='exit', callback is called when we've
|
||||
// received a fullscreenchange event and the window dimensions match
|
||||
// the window dimensions when the window opened (so don't resize the
|
||||
// window while running your test!). inDoc is the document which
|
||||
// the listeners are added on, if absent, the listeners are added to
|
||||
// the current document.
|
||||
function addFullscreenChangeContinuation(type, callback, inDoc) {
|
||||
var doc = inDoc || document;
|
||||
var topWin = doc.defaultView.top;
|
||||
// Remember the window size in non-fullscreen mode.
|
||||
if (!topWin.normalSize) {
|
||||
topWin.normalSize = {
|
||||
w: window.innerWidth,
|
||||
h: window.innerHeight
|
||||
};
|
||||
}
|
||||
function checkCondition() {
|
||||
if (type == "enter") {
|
||||
return inFullscreenMode(topWin);
|
||||
} else if (type == "exit") {
|
||||
// If we just revert the state to a previous fullscreen state,
|
||||
// the window won't back to the normal mode. Hence we check
|
||||
// fullscreenElement first here. Note that we need to check
|
||||
// the fullscreen element of the outmost document here instead
|
||||
// of the current one.
|
||||
return topWin.document.fullscreenElement || inNormalMode(topWin);
|
||||
} else {
|
||||
throw "'type' must be either 'enter', or 'exit'.";
|
||||
}
|
||||
}
|
||||
function invokeCallback(event) {
|
||||
// Use async call after a paint to workaround unfinished fullscreen
|
||||
// change even when the window size has changed on Linux.
|
||||
requestAnimationFrame(() => setTimeout(() => callback(event), 0), 0);
|
||||
}
|
||||
function onFullscreenChange(event) {
|
||||
doc.removeEventListener("fullscreenchange", onFullscreenChange, false);
|
||||
if (checkCondition()) {
|
||||
invokeCallback(event);
|
||||
return;
|
||||
}
|
||||
function onResize() {
|
||||
if (checkCondition()) {
|
||||
topWin.removeEventListener("resize", onResize, false);
|
||||
invokeCallback(event);
|
||||
}
|
||||
}
|
||||
topWin.addEventListener("resize", onResize, false);
|
||||
}
|
||||
doc.addEventListener("fullscreenchange", onFullscreenChange, false);
|
||||
}
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
function* test(testDriver) {
|
||||
document.addEventListener('click', clicked, false);
|
||||
|
||||
// Ensure the pointer is inside the window
|
||||
yield synthesizeNativeMouseEvent(document.getElementById('b'), 5, 5, nativeMouseMoveEventMsg(), driveTest);
|
||||
// mouse down, move it around, and release it near where it went down. this
|
||||
// should generate a click at the release point
|
||||
yield synthesizeNativeMouseEvent(document.getElementById('b'), 5, 5, nativeMouseDownEventMsg(), testDriver);
|
||||
|
|
Загрузка…
Ссылка в новой задаче