diff --git a/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html b/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html index e0fd4f2b32a..97f49e085f7 100644 --- a/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html +++ b/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html @@ -48,7 +48,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602 } function moveUnlocked(e) { - div.removeEventListener("mousemove", moveUnlocked, false); + var firstCall = !unLockedCoords; + if (!firstCall) { + todo(false, "mousemove is fired twice."); + } isUnlocked = !document.mozPointerLockElement; unLockedCoords = { @@ -58,6 +61,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602 clientY: e.clientY }; + if (!firstCall) { + return; + } + div.mozRequestPointerLock(); } @@ -77,6 +84,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602 document.addEventListener("mozpointerlockchange", function (e) { if (document.mozPointerLockElement === div) { + div.removeEventListener("mousemove", moveUnlocked, false); div.addEventListener("mousemove", moveLocked, false); divRect = div.getBoundingClientRect(); synthesizeMouse(div, (divRect.width / 4) * 3, (divRect.height / 4) * 3, {