--- a/browser/base/content/test/general/browser_domFullscreen_fullscreenMode.js
+++ b/browser/base/content/test/general/browser_domFullscreen_fullscreenMode.js
@@ -1,28 +1,28 @@
"use strict";
var gMessageManager;
function frameScript() {
addMessageListener("Test:RequestFullscreen", () => {
- content.document.body.mozRequestFullScreen();
+ content.document.body.requestFullscreen();
});
addMessageListener("Test:ExitFullscreen", () => {
- content.document.mozCancelFullScreen();
+ content.document.exitFullscreen();
});
addMessageListener("Test:QueryFullscreenState", () => {
sendAsyncMessage("Test:FullscreenState", {
- inDOMFullscreen: content.document.mozFullScreen,
+ inDOMFullscreen: !!content.document.fullscreenElement,
inFullscreen: content.fullScreen
});
});
- content.document.addEventListener("mozfullscreenchange", () => {
+ content.document.addEventListener("fullscreenchange", () => {
sendAsyncMessage("Test:FullscreenChanged", {
- inDOMFullscreen: content.document.mozFullScreen,
+ inDOMFullscreen: !!content.document.fullscreenElement,
inFullscreen: content.fullScreen
});
});
function waitUntilActive() {
let doc = content.document;
if (doc.docShell.isActive && doc.hasFocus()) {
sendAsyncMessage("Test:Activated");
} else {
@@ -125,17 +125,17 @@ function checkState(expectedStates, cont
"The DOM fullscreen state of the content should match");
// TODO window.fullScreen is not updated as soon as the fullscreen
// state flips in child process, hence checking it could cause
// anonying intermittent failure. As we just want to confirm the
// fullscreen state of the browser window, we can just check the
// that on the chrome window below.
// is(contentStates.inFullscreen, expectedStates.inFullscreen,
// "The fullscreen state of the content should match");
- is(document.mozFullScreen, expectedStates.inDOMFullscreen,
+ is(!!document.fullscreenElement, expectedStates.inDOMFullscreen,
"The DOM fullscreen state of the chrome should match");
is(window.fullScreen, expectedStates.inFullscreen,
"The fullscreen state of the chrome should match");
}
const kPage = "http://example.org/browser/browser/" +
"base/content/test/general/dummy_page.html";
--- a/browser/base/content/test/general/test_contextmenu.html
+++ b/browser/base/content/test/general/test_contextmenu.html
@@ -503,27 +503,27 @@ function runTest(testNum) {
"---", null,
"context-viewsource", true,
"context-viewinfo", true
].concat(inspectItems));
invokeItemAction("1");
closeContextMenu();
- // run mozRequestFullScreen on the element we're testing
+ // run requestFullscreen on the element we're testing
var full_screen_element = subwindow.document.getElementById("test-dom-full-screen");
var openDomFullScreen = function() {
- subwindow.removeEventListener("mozfullscreenchange", openDomFullScreen, false);
+ subwindow.removeEventListener("fullscreenchange", openDomFullScreen, false);
openContextMenuFor(dom_full_screen, true); // Invoke context menu for next test.
}
- subwindow.addEventListener("mozfullscreenchange", openDomFullScreen, false);
+ subwindow.addEventListener("fullscreenchange", openDomFullScreen, false);
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
SpecialPowers.setCharPref("full-screen-api.transition-duration.enter", "0 0");
SpecialPowers.setCharPref("full-screen-api.transition-duration.leave", "0 0");
- full_screen_element.mozRequestFullScreen();
+ full_screen_element.requestFullscreen();
},
function () {
// Context menu for DOM Fullscreen mode (NOTE: this is *NOT* on an img)
checkContextMenu(["context-navigation", null,
["context-back", false,
"context-forward", false,
"context-reload", true,
@@ -537,24 +537,24 @@ function runTest(testNum) {
"context-selectall", true,
"---", null,
"context-viewsource", true,
"context-viewinfo", true
].concat(inspectItems));
closeContextMenu();
var full_screen_element = subwindow.document.getElementById("test-dom-full-screen");
var openPagemenu = function() {
- subwindow.removeEventListener("mozfullscreenchange", openPagemenu, false);
+ subwindow.removeEventListener("fullscreenchange", openPagemenu, false);
SpecialPowers.clearUserPref("full-screen-api.allow-trusted-requests-only");
SpecialPowers.clearUserPref("full-screen-api.transition-duration.enter", "0 0");
SpecialPowers.clearUserPref("full-screen-api.transition-duration.leave", "0 0");
openContextMenuFor(pagemenu, true); // Invoke context menu for next test.
}
- subwindow.addEventListener("mozfullscreenchange", openPagemenu, false);
- subwindow.document.mozCancelFullScreen();
+ subwindow.addEventListener("fullscreenchange", openPagemenu, false);
+ subwindow.document.exitFullscreen();
},
function () {
// Context menu for element with assigned content context menu
// The shift key should bypass content context menu processing
checkContextMenu(["context-navigation", null,
["context-back", false,
"context-forward", false,
--- a/dom/html/test/browser_fullscreen-api-keys.js
+++ b/dom/html/test/browser_fullscreen-api-keys.js
@@ -6,27 +6,27 @@
const kKeyList = [
{ code: "VK_ESCAPE", suppressed: true},
{ code: "VK_F11", suppressed: false},
];
function frameScript() {
let doc = content.document;
addMessageListener("Test:RequestFullscreen", () => {
- doc.body.mozRequestFullScreen();
+ doc.body.requestFullscreen();
});
addMessageListener("Test:DispatchUntrustedKeyEvents", msg => {
var evt = new content.CustomEvent("Test:DispatchKeyEvents", {
detail: { code: msg.data }
});
content.dispatchEvent(evt);
});
- doc.addEventListener("mozfullscreenchange", () => {
- sendAsyncMessage("Test:FullscreenChanged", !!doc.mozFullScreenElement);
+ doc.addEventListener("fullscreenchange", () => {
+ sendAsyncMessage("Test:FullscreenChanged", !!doc.fullscreenElement);
});
function keyHandler(evt) {
sendAsyncMessage("Test:KeyReceived", {
type: evt.type,
keyCode: evt.keyCode
});
}
@@ -137,17 +137,17 @@ add_task(function* () {
var keyCode = KeyEvent["DOM_" + code];
info(`Test keycode ${code} (${keyCode})`);
info("Enter fullscreen");
yield* temporaryRemoveUnexpectedFullscreenChangeCapture(function* () {
gMessageManager.sendAsyncMessage("Test:RequestFullscreen");
let state = yield promiseOneMessage("Test:FullscreenChanged");
ok(state, "The content should have entered fullscreen");
- ok(document.mozFullScreenElement,
+ ok(document.fullscreenElement,
"The chrome should also be in fullscreen");
});
info("Dispatch untrusted key events from content");
yield* temporaryRemoveUnexpectedKeyEventCapture(function* () {
let promiseExpectedKeyEvents = receiveExpectedKeyEvents(keyCode);
gMessageManager.sendAsyncMessage("Test:DispatchUntrustedKeyEvents", code);
yield promiseExpectedKeyEvents;
@@ -157,14 +157,14 @@ add_task(function* () {
yield* temporaryRemoveUnexpectedFullscreenChangeCapture(function* () {
yield* temporaryRemoveUnexpectedKeyEventCapture(function* () {
let promiseExpectedKeyEvents = suppressed ?
Promise.resolve() : receiveExpectedKeyEvents(keyCode);
EventUtils.synthesizeKey(code, {});
yield promiseExpectedKeyEvents;
let state = yield promiseOneMessage("Test:FullscreenChanged");
ok(!state, "The content should have exited fullscreen");
- ok(!document.mozFullScreenElement,
+ ok(!document.fullscreenElement,
"The chrome should also have exited fullscreen");
});
});
}
});
--- a/dom/html/test/browser_fullscreen-contextmenu-esc.js
+++ b/dom/html/test/browser_fullscreen-contextmenu-esc.js
@@ -1,19 +1,21 @@
"use strict";
function frameScript() {
addMessageListener("Test:RequestFullscreen", () => {
- content.document.body.mozRequestFullScreen();
+ content.document.body.requestFullscreen();
});
- content.document.addEventListener("mozfullscreenchange", () => {
- sendAsyncMessage("Test:FullscreenChanged", content.document.mozFullScreen);
+ content.document.addEventListener("fullscreenchange", () => {
+ sendAsyncMessage("Test:FullscreenChanged",
+ !!content.document.fullscreenElement);
});
addMessageListener("Test:QueryFullscreenState", () => {
- sendAsyncMessage("Test:FullscreenState", content.document.mozFullScreen);
+ sendAsyncMessage("Test:FullscreenState",
+ !!content.document.fullscreenElement);
});
function waitUntilActive() {
let doc = content.document;
if (doc.docShell.isActive && doc.hasFocus()) {
sendAsyncMessage("Test:Activated");
} else {
setTimeout(waitUntilActive, 10);
}
@@ -63,17 +65,17 @@ add_task(function* () {
let contextMenu = document.getElementById("contentAreaContextMenu");
ok(contextMenu, "Got context menu");
let state;
info("Enter DOM fullscreen");
gMessageManager.sendAsyncMessage("Test:RequestFullscreen");
state = yield promiseOneMessage("Test:FullscreenChanged");
ok(state, "The content should have entered fullscreen");
- ok(document.mozFullScreen, "The chrome should also be in fullscreen");
+ ok(document.fullscreenElement, "The chrome should also be in fullscreen");
gMessageManager.addMessageListener(
"Test:FullscreenChanged", captureUnexpectedFullscreenChange);
info("Open context menu");
is(contextMenu.state, "closed", "Should not have opened context menu");
let popupShownPromise = promiseWaitForEvent(window, "popupshown");
EventUtils.synthesizeMouse(browser, screen.width / 2, screen.height / 2,
{type: "contextmenu", button: 2}, window);
@@ -87,19 +89,19 @@ add_task(function* () {
is(contextMenu.state, "closed", "Should have closed context menu");
// Wait a small time to confirm that the first ESC key
// does not exit fullscreen.
yield new Promise(resolve => setTimeout(resolve, 1000));
gMessageManager.sendAsyncMessage("Test:QueryFullscreenState");
state = yield promiseOneMessage("Test:FullscreenState");
ok(state, "The content should still be in fullscreen");
- ok(document.mozFullScreen, "The chrome should still be in fullscreen");
+ ok(document.fullscreenElement, "The chrome should still be in fullscreen");
info("Send the second escape");
gMessageManager.removeMessageListener(
"Test:FullscreenChanged", captureUnexpectedFullscreenChange);
let fullscreenExitPromise = promiseOneMessage("Test:FullscreenChanged");
EventUtils.synthesizeKey("VK_ESCAPE", {});
state = yield fullscreenExitPromise;
ok(!state, "The content should have exited fullscreen");
- ok(!document.mozFullScreen, "The chrome should have exited fullscreen");
+ ok(!document.fullscreenElement, "The chrome should have exited fullscreen");
});
--- a/dom/html/test/file_fullscreen-api.html
+++ b/dom/html/test/file_fullscreen-api.html
@@ -27,22 +27,22 @@ function ok(condition, msg) {
}
function is(a, b, msg) {
opener.is(a, b, "[fullscreen] " + msg);
}
/*
<html>
- <body onload='document.body.mozRequestFullScreen();'>
+ <body onload='document.body.requestFullscreen();'>
<iframe id='inner-frame'></iframe>
</body>
</html>
*/
-var iframeContents = "data:text/html;charset=utf-8,<html><body onload%3D'parent.SimpleTest.waitForFocus(function(){document.body.mozRequestFullScreen();});'><iframe id%3D'inner-frame'><%2Fiframe><%2Fbody><%2Fhtml>";
+var iframeContents = "data:text/html;charset=utf-8,<html><body onload%3D'parent.SimpleTest.waitForFocus(function(){document.body.requestFullscreen();});'><iframe id%3D'inner-frame'><%2Fiframe><%2Fbody><%2Fhtml>";
var iframe = null;
var outOfDocElement = null;
var inDocElement = null;
var container = null;
var button = null;
@@ -50,211 +50,220 @@ function sendMouseClick(element) {
synthesizeMouseAtCenter(element, {});
}
function fullScreenElement() {
return document.getElementById('full-screen-element');
}
function enter1(event) {
- ok(document.mozFullScreen, "1. Should be in full-screen mode (first time)");
- is(event.target, document, "2. Event target should be full-screen document #1");
- is(document.mozFullScreenElement, fullScreenElement(), "3. Full-screen element should be div element.");
- ok(document.mozFullScreenElement.matches(":-moz-full-screen"), "4. FSE should match :-moz-full-screen");
+ is(event.target, document, "Event target should be full-screen document #1");
+ is(document.fullscreenElement, fullScreenElement(),
+ "Full-screen element should be div element.");
+ ok(document.fullscreenElement.matches(":fullscreen"),
+ "FSE should match :fullscreen");
var fse = fullScreenElement();
addFullscreenChangeContinuation("exit", exit1);
fse.parentNode.removeChild(fse);
- is(document.mozFullScreenElement, null, "5. Full-screen element should be null after removing.");
- ok(!document.mozFullScreen, "6. Should have left full-screen mode when we remove full-screen element");
+ is(document.fullscreenElement, null,
+ "Full-screen element should be null after removing.");
document.body.appendChild(fse);
- ok(!document.mozFullScreen, "7. Should not return to full-screen mode when re-adding former FSE");
- is(document.mozFullScreenElement, null, "8. Full-screen element should still be null after re-adding former FSE.");
+ is(document.fullscreenElement, null,
+ "Full-screen element should still be null after re-adding former FSE.");
}
function exit1(event) {
- ok(!document.mozFullScreen, "9. Should have left full-screen mode (first time)");
- is(event.target, document, "10. Event target should be full-screen document #2");
- is(document.mozFullScreenElement, null, "11. Full-screen element should be null.");
+ is(event.target, document, "Event target should be full-screen document #2");
+ is(document.fullscreenElement, null, "Full-screen element should be null.");
iframe = document.createElement("iframe");
iframe.allowFullscreen = true;
addFullscreenChangeContinuation("enter", enter2);
document.body.appendChild(iframe);
iframe.src = iframeContents;
}
function enter2(event) {
- ok(document.mozFullScreen, "12. Should be back in full-screen mode (second time)");
- is(event.target, document, "13. Event target should be full-screen document #3");
- is(document.mozFullScreenElement, iframe, "14. Full-screen element should be iframe element.");
- is(iframe.contentDocument.mozFullScreenElement, iframe.contentDocument.body, "15. Full-screen element in subframe should be body");
+ is(event.target, document, "Event target should be full-screen document #3");
+ is(document.fullscreenElement, iframe,
+ "Full-screen element should be iframe element.");
+ is(iframe.contentDocument.fullscreenElement, iframe.contentDocument.body,
+ "Full-screen element in subframe should be body");
// The iframe's body is full-screen. Cancel full-screen in the subdocument to return
// the full-screen element to the previous full-screen element. This causes
// a fullscreenchange event.
addFullscreenChangeContinuation("exit", exit2);
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
function exit2(event) {
- ok(!document.mozFullScreen, "16. Should have left full-screen when canceling fullscreen in ancestor document.");
- is(document.mozFullScreenElement, null, "17. Full-screen element should have rolled back.");
- is(iframe.contentDocument.mozFullScreenElement, null, "18. Full-screen element in subframe should be null");
+ is(document.fullscreenElement, null,
+ "Full-screen element should have rolled back.");
+ is(iframe.contentDocument.fullscreenElement, null,
+ "Full-screen element in subframe should be null");
addFullscreenChangeContinuation("enter", enter3);
- fullScreenElement().mozRequestFullScreen();
+ fullScreenElement().requestFullscreen();
}
function enter3(event) {
- ok(document.mozFullScreen, "19. Should be back in full-screen mode (second time)");
- is(event.target, document, "20. Event target should be full-screen document #3");
- is(document.mozFullScreenElement, fullScreenElement(), "21. Full-screen element should be div.");
+ is(event.target, document, "Event target should be full-screen document #3");
+ is(document.fullscreenElement, fullScreenElement(),
+ "Full-screen element should be div.");
// Transplant the FSE into subdoc. Should exit full-screen.
addFullscreenChangeContinuation("exit", exit3);
var _innerFrame = iframe.contentDocument.getElementById("inner-frame");
var fse = fullScreenElement();
_innerFrame.contentDocument.body.appendChild(fse);
- ok(!document.mozFullScreen, "22. Should exit full-screen after transplanting FSE");
- is(document.mozFullScreenElement, null, "23. Full-screen element transplanted, should be null.");
- is(iframe.contentDocument.mozFullScreenElement, null, "24. Full-screen element in outer frame should be null.");
- is(_innerFrame.contentDocument.mozFullScreenElement, null, "25. Full-screen element in inner frame should be null.");
- ok(!iframe.contentDocument.mozFullScreen, "26. Outer frame should not acquire full-screen status.");
- ok(!_innerFrame.contentDocument.mozFullScreen, "27. Inner frame should not acquire full-screen status.");
+ is(document.fullscreenElement, null,
+ "Full-screen element transplanted, should be null.");
+ is(iframe.contentDocument.fullscreenElement, null,
+ "Full-screen element in outer frame should be null.");
+ is(_innerFrame.contentDocument.fullscreenElement, null,
+ "Full-screen element in inner frame should be null.");
document.body.appendChild(fse);
}
function exit3(event) {
- ok(!document.mozFullScreen, "28. Should be back in non-full-screen mode (second time)");
- is(event.target, document, "29. Event target should be full-screen document #4");
- is(document.mozFullScreenElement, null, "30. Full-screen element should be null.");
+ is(event.target, document, "Event target should be full-screen document #4");
+ is(document.fullscreenElement, null, "Full-screen element should be null.");
document.body.removeChild(iframe);
iframe = null;
// Do a request out of document. It should be denied.
- // Continue test in the following mozfullscreenerror handler.
+ // Continue test in the following fullscreenerror handler.
outOfDocElement = document.createElement("div");
addFullscreenErrorContinuation(error1);
- outOfDocElement.mozRequestFullScreen();
+ outOfDocElement.requestFullscreen();
}
function error1(event) {
- ok(!document.mozFullScreen, "31. Requests for full-screen from not-in-doc elements should fail.");
+ ok(!document.fullscreenElement,
+ "Requests for full-screen from not-in-doc elements should fail.");
container = document.createElement("div");
inDocElement = document.createElement("div");
container.appendChild(inDocElement);
fullScreenElement().appendChild(container);
addFullscreenChangeContinuation("enter", enter4);
- inDocElement.mozRequestFullScreen();
+ inDocElement.requestFullscreen();
}
function enter4(event) {
- ok(document.mozFullScreen, "32. Should still be in full-screen mode (third time)");
- is(event.target, document, "33. Event target should be full-screen document #5");
- is(document.mozFullScreenElement, inDocElement, "35. FSE should be inDocElement.");
+ is(event.target, document, "Event target should be full-screen document #5");
+ is(document.fullscreenElement, inDocElement, "FSE should be inDocElement.");
var n = container;
do {
ok(n.matches(":-moz-full-screen-ancestor"), "Ancestor " + n + " should match :-moz-full-screen-ancestor")
n = n.parentNode;
} while (n && n.matches);
// Remove full-screen ancestor element from document, verify it stops being reported as current FSE.
addFullscreenChangeContinuation("exit", exit_to_arg_test_1);
container.parentNode.removeChild(container);
- ok(!document.mozFullScreen, "36. Should exit full-screen mode after removing full-screen element ancestor from document");
- is(document.mozFullScreenElement, null, "37. Should not have a full-screen element again.");
+ is(document.fullscreenElement, null,
+ "Should not have a full-screen element again.");
}
function exit_to_arg_test_1(event) {
- ok(!document.mozFullScreen, "Should have left full-screen mode (third time).");
+ ok(!document.fullscreenElement,
+ "Should have left full-screen mode (third time).");
addFullscreenChangeContinuation("enter", enter_from_arg_test_1);
var threw = false;
try {
- fullScreenElement().mozRequestFullScreen(123);
+ fullScreenElement().requestFullscreen(123);
} catch (e) {
threw = true;
// trigger normal fullscreen so that we continue
- fullScreenElement().mozRequestFullScreen();
+ fullScreenElement().requestFullscreen();
}
- ok(!threw, "mozRequestFullScreen with bogus arg (123) shouldn't throw exception");
+ ok(!threw, "requestFullscreen with bogus arg (123) shouldn't throw exception");
}
function enter_from_arg_test_1(event) {
- ok(document.mozFullScreen, "Should have entered full-screen after calling with bogus (ignored) argument (fourth time)");
+ ok(document.fullscreenElement,
+ "Should have entered full-screen after calling with bogus (ignored) argument (fourth time)");
addFullscreenChangeContinuation("exit", exit_to_arg_test_2);
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
function exit_to_arg_test_2(event) {
- ok(!document.mozFullScreen, "Should have left full-screen mode (fourth time).");
+ ok(!document.fullscreenElement,
+ "Should have left full-screen mode (fourth time).");
addFullscreenChangeContinuation("enter", enter_from_arg_test_2);
var threw = false;
try {
- fullScreenElement().mozRequestFullScreen({ vrDisplay: null });
+ fullScreenElement().requestFullscreen({ vrDisplay: null });
} catch (e) {
threw = true;
// trigger normal fullscreen so that we continue
- fullScreenElement().mozRequestFullScreen();
+ fullScreenElement().requestFullscreen();
}
- ok(!threw, "mozRequestFullScreen with { vrDisplay: null } shouldn't throw exception");
+ ok(!threw, "requestFullscreen with { vrDisplay: null } shouldn't throw exception");
}
function enter_from_arg_test_2(event) {
- ok(document.mozFullScreen, "Should have entered full-screen after calling with vrDisplay null argument (fifth time)");
+ ok(document.fullscreenElement,
+ "Should have entered full-screen after calling with vrDisplay null argument (fifth time)");
addFullscreenChangeContinuation("exit", exit4);
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
function exit4(event) {
- ok(!document.mozFullScreen, "38. Should be back in non-full-screen mode (fifth time)");
+ ok(!document.fullscreenElement,
+ "Should be back in non-full-screen mode (fifth time)");
SpecialPowers.pushPrefEnv({"set":[["full-screen-api.allow-trusted-requests-only", true]]}, function() {
addFullscreenErrorContinuation(error2);
- fullScreenElement().mozRequestFullScreen();
+ fullScreenElement().requestFullscreen();
});
}
function error2(event) {
- ok(!document.mozFullScreen, "Should still be in normal mode, because calling context isn't trusted.");
+ ok(!document.fullscreenElement,
+ "Should still be in normal mode, because calling context isn't trusted.");
button = document.createElement("button");
- button.onclick = function(){fullScreenElement().mozRequestFullScreen();}
+ button.onclick = function(){fullScreenElement().requestFullscreen();}
fullScreenElement().appendChild(button);
addFullscreenChangeContinuation("enter", enter5);
sendMouseClick(button);
}
function enter5(event) {
- ok(document.mozFullScreen, "Moved to full-screen after mouse click");
+ ok(document.fullscreenElement, "Moved to full-screen after mouse click");
addFullscreenChangeContinuation("exit", exit5);
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
function exit5(event) {
- ok(!document.mozFullScreen, "Should have left full-screen mode (last time).");
+ ok(!document.fullscreenElement,
+ "Should have left full-screen mode (last time).");
SpecialPowers.pushPrefEnv({
"set":[["full-screen-api.allow-trusted-requests-only", false],
["full-screen-api.enabled", false]]}, function() {
- is(document.mozFullScreenEnabled, false, "document.mozFullScreenEnabled should be false if full-screen-api.enabled is false");
+ is(document.fullscreenEnabled, false, "document.fullscreenEnabled should be false if full-screen-api.enabled is false");
addFullscreenErrorContinuation(error3);
- fullScreenElement().mozRequestFullScreen();
+ fullScreenElement().requestFullscreen();
});
}
function error3(event) {
- ok(!document.mozFullScreen, "Should still be in normal mode, because pref is not enabled.");
+ ok(!document.fullscreenElement,
+ "Should still be in normal mode, because pref is not enabled.");
SpecialPowers.pushPrefEnv({"set":[["full-screen-api.enabled", true]]}, function() {
- is(document.mozFullScreenEnabled, true, "document.mozFullScreenEnabled should be true if full-screen-api.enabled is true");
+ is(document.fullscreenEnabled, true, "document.fullscreenEnabled should be true if full-screen-api.enabled is true");
opener.nextTest();
});
}
function begin() {
addFullscreenChangeContinuation("enter", enter1);
- fullScreenElement().mozRequestFullScreen();
+ fullScreenElement().requestFullscreen();
}
</script>
</pre>
<div id="full-screen-element"></div>
</body>
</html>
--- a/dom/html/test/file_fullscreen-backdrop.html
+++ b/dom/html/test/file_fullscreen-backdrop.html
@@ -37,17 +37,17 @@ function synthesizeMouseAtWindowCenter()
}
const gFullscreenElementBackground = getComputedStyle(gFullscreen).background;
function begin() {
info("The default background of window should be white");
assertWindowPureColor(window, "white");
addFullscreenChangeContinuation("enter", enterFullscreen);
- gFullscreen.mozRequestFullScreen();
+ gFullscreen.requestFullscreen();
}
function setBackdropStyle(style) {
gStyle.textContent = `#fullscreen::backdrop { ${style} }`;
}
function enterFullscreen() {
is(getComputedStyle(gFullscreen).background, gFullscreenElementBackground,
@@ -73,17 +73,17 @@ function enterFullscreen() {
info("Content should return to black because we restore the backdrop");
assertWindowPureColor(window, "black");
gFullscreen.style.display = "none";
info("The backdrop should disappear with the fullscreen element");
assertWindowPureColor(window, "white");
addFullscreenChangeContinuation("exit", exitFullscreen);
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
function exitFullscreen() {
opener.nextTest();
}
</script>
</body>
</html>
--- a/dom/html/test/file_fullscreen-denied-inner.html
+++ b/dom/html/test/file_fullscreen-denied-inner.html
@@ -2,23 +2,23 @@
<html>
<head>
<meta charset="UTF-8">
</head>
<body onload="doRequestFullscreen()">
<script>
function doRequestFullscreen() {
function handler(evt) {
- document.removeEventListener("mozfullscreenchange", handler);
- document.removeEventListener("mozfullscreenerror", handler);
- parent.is(evt.type, "mozfullscreenerror", "Request from " +
+ document.removeEventListener("fullscreenchange", handler);
+ document.removeEventListener("fullscreenerror", handler);
+ parent.is(evt.type, "fullscreenerror", "Request from " +
`document inside ${parent.testTargetName} should be denied`);
parent.continueTest();
}
- parent.ok(!document.mozFullScreenEnabled, "Fullscreen " +
+ parent.ok(!document.fullscreenEnabled, "Fullscreen " +
`should not be enabled in ${parent.testTargetName}`);
- document.addEventListener("mozfullscreenchange", handler);
- document.addEventListener("mozfullscreenerror", handler);
- document.documentElement.mozRequestFullScreen();
+ document.addEventListener("fullscreenchange", handler);
+ document.addEventListener("fullscreenerror", handler);
+ document.documentElement.requestFullscreen();
}
</script>
</body>
</html>
--- a/dom/html/test/file_fullscreen-denied.html
+++ b/dom/html/test/file_fullscreen-denied.html
@@ -37,17 +37,17 @@ function setupForInnerTest(targetName, c
window.continueTest = () => {
delete window.testTargetName;
delete window.continueTest;
callback();
};
}
function begin() {
- document.addEventListener("mozfullscreenchange", () => {
+ document.addEventListener("fullscreenchange", () => {
ok(false, "Should never receive " +
"a fullscreenchange event in the main window.");
});
SimpleTest.executeSoon(testIFrameWithoutAllowFullscreen);
}
function testIFrameWithoutAllowFullscreen() {
// Create an iframe without an allowfullscreen attribute, whose
@@ -85,37 +85,37 @@ function testObjectElement() {
"set":[["full-screen-api.allow-trusted-requests-only", true]]
}, testNonTrustContext);
});
document.body.appendChild(objectElem);
}
function testNonTrustContext() {
addFullscreenErrorContinuation(() => {
- ok(!document.mozFullScreen,
+ ok(!document.fullscreenElement,
"Should not grant request in non-trust context.");
SimpleTest.executeSoon(testLongRunningEventHandler);
});
- document.documentElement.mozRequestFullScreen();
+ document.documentElement.requestFullscreen();
}
function testLongRunningEventHandler() {
function longRunningHandler() {
window.removeEventListener("keypress", longRunningHandler);
// Busy loop until 2s has passed. We should then be past the one
// second threshold, and so our request for fullscreen should be
// rejected.
var end = (new Date()).getTime() + 2000;
while ((new Date()).getTime() < end) {
; // Wait...
}
- document.documentElement.mozRequestFullScreen();
+ document.documentElement.requestFullscreen();
}
addFullscreenErrorContinuation(() => {
- ok(!document.mozFullScreen,
+ ok(!document.fullscreenElement,
"Should not grant request in long-running event handler.");
// Restore the pref environment we changed before
// entering testNonTrustContext.
SpecialPowers.popPrefEnv(finish);
});
window.addEventListener("keypress", longRunningHandler);
synthesizeKey("VK_A", {});
}
--- a/dom/html/test/file_fullscreen-esc-exit-inner.html
+++ b/dom/html/test/file_fullscreen-esc-exit-inner.html
@@ -6,17 +6,17 @@ https://bugzilla.mozilla.org/show_bug.cg
Verify that an ESC key press in a subdoc of a full-screen doc causes us to
exit DOM full-screen mode.
-->
<head>
<title>Test for Bug 700764</title>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<style>
- body:not(:-moz-full-screen) {
+ body:not(:fullscreen) {
background-color: blue;
}
</style>
</head>
<body>
<script type="application/javascript">
@@ -39,18 +39,18 @@ function keyHandler(event) {
}
}
window.addEventListener("keydown", keyHandler, true);
window.addEventListener("keyup", keyHandler, true);
window.addEventListener("keypress", keyHandler, true);
function startTest() {
- ok(!document.mozFullScreen, "Subdoc should not be in full-screen mode");
- ok(parent.document.mozFullScreen, "Parent should be in full-screen mode");
+ ok(!document.fullscreenElement, "Subdoc should not be in full-screen mode");
+ ok(parent.document.fullscreenElement, "Parent should be in full-screen mode");
escKeySent = true;
window.focus();
synthesizeKey("VK_ESCAPE", {});
}
</script>
</pre>
<p>Inner frame</p>
--- a/dom/html/test/file_fullscreen-esc-exit.html
+++ b/dom/html/test/file_fullscreen-esc-exit.html
@@ -8,17 +8,17 @@ exit DOM full-screen mode.
-->
<head>
<title>Test for Bug 700764</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript" src="file_fullscreen-utils.js"></script>
<style>
- body:-moz-full-screen, div:-moz-full-screen {
+ body:fullscreen, div:fullscreen {
background-color: red;
}
</style>
</head>
<body>
<script type="application/javascript">
@@ -30,33 +30,32 @@ function is(a, b, msg) {
opener.is(a, b, "[esc-exit] " + msg);
}
function finish() {
opener.nextTest();
}
function fullscreenchange1(event) {
- ok(document.mozFullScreen, "Should have entered full-screen mode");
- is(document.mozFullScreenElement, document.body, "FSE should be doc");
+ is(document.fullscreenElement, document.body, "FSE should be doc");
addFullscreenChangeContinuation("exit", fullscreenchange2);
ok(!document.getElementById("subdoc").contentWindow.escKeySent, "Should not yet have sent ESC key press.");
document.getElementById("subdoc").contentWindow.startTest();
}
function fullscreenchange2(event) {
ok(document.getElementById("subdoc").contentWindow.escKeySent, "Should have sent ESC key press.");
ok(!document.getElementById("subdoc").contentWindow.escKeyReceived, "ESC key press to exit should not be delivered.");
- ok(!document.mozFullScreen, "Should have left full-screen mode on ESC key press");
+ ok(!document.fullscreenElement, "Should have left full-screen mode on ESC key press");
finish();
}
function begin() {
addFullscreenChangeContinuation("enter", fullscreenchange1);
- document.body.mozRequestFullScreen();
+ document.body.requestFullscreen();
}
</script>
<!-- This subframe conducts the test. -->
<iframe id="subdoc" src="file_fullscreen-esc-exit-inner.html"></iframe>
</pre>
--- a/dom/html/test/file_fullscreen-hidden.html
+++ b/dom/html/test/file_fullscreen-hidden.html
@@ -29,23 +29,27 @@ function begin()
{
frameWin = document.getElementById("f").contentWindow;
e1 = frameWin.document.documentElement;
frameWin.location = "data:text/html,<body text=blue onload='parent.b2()'>2";
}
function b2()
{
- try { e1.mozRequestFullScreen(); } catch(e) { opener.ok(false, "[hidden] Should not enter full-screen"); }
+ try {
+ e1.requestFullscreen();
+ } catch(e) {
+ opener.ok(false, "[hidden] Should not enter full-screen");
+ }
setTimeout(done, 0);
}
function done() {
- opener.ok(!document.mozFullScreen, "[hidden] Should not have entered full-screen mode in hidden document.");
- opener.ok(!e1.ownerDocument.mozFullScreen, "[hidden] Requesting owner should not have entered full-screen mode.");
+ opener.ok(!document.fullscreenElement, "[hidden] Should not have entered full-screen mode in hidden document.");
+ opener.ok(!e1.ownerDocument.fullscreenElement, "[hidden] Requesting owner should not have entered full-screen mode.");
opener.nextTest();
}
</script>
</pre>
</body>
</html>
--- a/dom/html/test/file_fullscreen-multiple-inner.html
+++ b/dom/html/test/file_fullscreen-multiple-inner.html
@@ -13,16 +13,16 @@
function begin(id) {
addFullscreenErrorContinuation(function() {
opener.ok(false, "Fullscreen denied " + id);
});
addFullscreenChangeContinuation("enter",
function() {
opener.enteredFullscreen(id);
});
- document.body.mozRequestFullScreen();
+ document.body.requestFullscreen();
}
</script>
</pre>
</body>
</html>
--- a/dom/html/test/file_fullscreen-multiple.html
+++ b/dom/html/test/file_fullscreen-multiple.html
@@ -43,18 +43,18 @@ function openWindow(id) {
function begin() {
window1 = openWindow("one");
}
function enteredFullscreen(id) {
if (id == "one") {
window2 = openWindow("two");
} else if (id == "two") {
- ok(window1.document.mozFullScreenElement &&
- window2.document.mozFullScreenElement,
+ ok(window1.document.fullscreenElement &&
+ window2.document.fullscreenElement,
"Both windows should be fullscreen concurrently");
window1.close();
window2.close();
opener.nextTest();
}
}
</script>
--- a/dom/html/test/file_fullscreen-navigation.html
+++ b/dom/html/test/file_fullscreen-navigation.html
@@ -26,27 +26,27 @@ var frameWin;
var e1;
var prevEnabled;
var prevTrusted;
function begin()
{
frameWin = document.getElementById("f").contentWindow;
e1 = frameWin.document.body;
- document.addEventListener("mozfullscreenchange", function onfullscreen() {
- document.removeEventListener("mozfullscreenchange", onfullscreen, false);
- opener.ok(document.mozFullScreen, "[navigation] Request should be granted");
+ document.addEventListener("fullscreenchange", function onfullscreen() {
+ document.removeEventListener("fullscreenchange", onfullscreen, false);
+ opener.ok(document.fullscreenElement, "[navigation] Request should be granted");
frameWin.location = "data:text/html,<body text=blue onload='parent.b2()'>2";
}, false);
- e1.mozRequestFullScreen();
+ e1.requestFullscreen();
}
function b2()
{
- opener.ok(!document.mozFullScreen, "[navigation] Should have left full-screen due to navigation.");
+ opener.ok(!document.fullscreenElement, "[navigation] Should have left full-screen due to navigation.");
opener.nextTest();
}
</script>
</pre>
</body>
</html>
--- a/dom/html/test/file_fullscreen-nested.html
+++ b/dom/html/test/file_fullscreen-nested.html
@@ -89,32 +89,32 @@ function nextStep() {
opener.nextTest();
return;
}
var index = gTestIndex;
var [[action, target], [fsOuter, fsInner]] = gTestSteps[gTestIndex++];
function checkAndNext() {
- is(document.mozFullScreenElement, fsOuter,
+ is(document.fullscreenElement, fsOuter,
`Fullscreen element of outer doc should match after step ${index}`);
- is(gInnerDoc.mozFullScreenElement, fsInner,
+ is(gInnerDoc.fullscreenElement, fsInner,
`Fullscreen element of inner doc should match after step ${index}`);
nextStep();
}
info(`Executing step ${index}: ${action} on ${target}...`);
if (action == "enter") {
// For "enter" action, the target is the element
var doc = target.ownerDocument;
addFullscreenChangeContinuation("enter", checkAndNext, doc);
- target.mozRequestFullScreen();
+ target.requestFullscreen();
} else if (action == "exit") {
// For "exit" action, the target is the document
addFullscreenChangeContinuation("exit", checkAndNext, target);
- target.mozCancelFullScreen();
+ target.exitFullscreen();
} else {
ok(false, `Unknown action ${action}`);
}
}
</script>
</body>
</html>
--- a/dom/html/test/file_fullscreen-plugins.html
+++ b/dom/html/test/file_fullscreen-plugins.html
@@ -17,17 +17,17 @@ Test plugins with DOM full-screen API:
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="plugin-utils.js"></script>
<script type="application/javascript">
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
</script>
<script type="application/javascript" src="file_fullscreen-utils.js"></script>
<style>
- body:-moz-full-screen, div:-moz-full-screen {
+ body:fullscreen, div:fullscreen {
background-color: red;
}
</style>
</head>
<body>
<!-- Windowed plugin, focusing should revoke full-screen. -->
@@ -75,51 +75,51 @@ function begin() {
opener.SimpleTest.executeSoon(function() {
opener.SimpleTest.executeSoon(function() {
startTest();
})
});
}
function startTest() {
- ok(!document.mozFullScreen, "Should not be in full-screen mode initially");
- document.body.mozRequestFullScreen();
+ ok(!document.fullscreenElement, "Should not be in full-screen mode initially");
+ document.body.requestFullscreen();
// Focus the windowed plugin. On MacOS we should still enter full-screen mode,
// on windows the pending request for full-screen should be denied.
e("windowed-plugin").focus();
if (isMacOs) {
// Running on MacOS, all plugins are effectively windowless, request for full-screen should be granted.
- // Continue test in the (mac-specific) "mozfullscreenchange" handler.
+ // Continue test in the (mac-specific) "fullscreenchange" handler.
addFullscreenChangeContinuation("enter", macFullScreenChange1);
} else {
// Non-MacOS, request should be denied, carry on the test after receiving error event.
addFullscreenErrorContinuation(nonMacTest);
}
}
function nonMacTest() {
- ok(!document.mozFullScreen, "Request for full-screen with focused windowed plugin should be denied.");
+ ok(!document.fullscreenElement, "Request for full-screen with focused windowed plugin should be denied.");
// Focus a regular html element, and re-request full-screen, request should be granted.
e("windowless-plugin").focus();
addFullscreenChangeContinuation("enter", nonMacTest2);
- document.body.mozRequestFullScreen();
+ document.body.requestFullscreen();
}
function nonMacTest2() {
- ok(document.mozFullScreen, "Request for full-screen with non-plugin focused should be granted.");
+ ok(document.fullscreenElement, "Request for full-screen with non-plugin focused should be granted.");
// Focus a windowed plugin, full-screen should be revoked.
addFullscreenChangeContinuation("exit", nonMacTest3);
e("windowed-plugin").focus();
}
function nonMacTest3() {
- ok(!document.mozFullScreen, "Full-screen should have been revoked when windowed-plugin was focused.");
+ ok(!document.fullscreenElement, "Full-screen should have been revoked when windowed-plugin was focused.");
// Remove windowed plugins before closing the window
// to work around bug 1237853.
removeElement(e("windowed-plugin"));
removeElement(e("subdoc-plugin").contentDocument.getElementById("windowed-plugin"));
opener.nextTest();
}
var fullScreenChangeCount = 0;
@@ -127,34 +127,34 @@ var fullScreenChangeCount = 0;
function createWindowedPlugin() {
var p = document.createElement("embed");
p.setAttribute("type", "application/x-test");
p.setAttribute("wmode", "window");
return p;
}
function macFullScreenChange1(event) {
- ok(document.mozFullScreen, "Requests for full-screen with focused windowed plugins should be granted on MacOS");
+ ok(document.fullscreenElement, "Requests for full-screen with focused windowed plugins should be granted on MacOS");
// Create a new windowed plugin, and add that to the document. Should *not* exit full-screen mode on MacOS.
windowedPlugin = createWindowedPlugin();
document.body.appendChild(windowedPlugin);
// Focus windowed plugin. Should not exit full-screen mode on MacOS.
windowedPlugin.focus();
setTimeout(
function() {
- ok(document.mozFullScreen, "Adding & focusing a windowed plugin to document should not cause full-screen to exit on MacOS.");
+ ok(document.fullscreenElement, "Adding & focusing a windowed plugin to document should not cause full-screen to exit on MacOS.");
addFullscreenChangeContinuation("exit", macFullScreenChange2);
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}, 0);
}
function macFullScreenChange2(event) {
- ok(!document.mozFullScreen, "Should have left full-screen mode after calling document.mozCancelFullScreen().");
+ ok(!document.fullscreenElement, "Should have left full-screen mode after calling document.exitFullscreen().");
opener.nextTest();
}
</script>
</pre>
</body>
</html>
--- a/dom/html/test/file_fullscreen-rollback.html
+++ b/dom/html/test/file_fullscreen-rollback.html
@@ -48,81 +48,81 @@ function is(a, b, msg) {
if (a != b) {
opener.finish();
}
}
function enterFullscreen(element, callback) {
addFullscreenChangeContinuation("enter", callback);
element.focus();
- element.mozRequestFullScreen();
+ element.requestFullscreen();
}
function revertFullscreen(doc, callback) {
- ok(doc.mozFullScreenElement != null, "Should only exit fullscreen on a fullscreen doc");
+ ok(doc.fullscreenElement != null, "Should only exit fullscreen on a fullscreen doc");
addFullscreenChangeContinuation("exit", callback, doc);
- doc.mozCancelFullScreen();
+ doc.exitFullscreen();
}
function e(id) {
return document.getElementById(id);
}
function requestFullscreen(element) {
element.focus();
- element.mozRequestFullScreen();
+ element.requestFullscreen();
}
function begin() {
enterFullscreen(e("fse"), change1);
}
function change1() {
- is(document.mozFullScreenElement, e("fse"), "Body should be FSE");
+ is(document.fullscreenElement, e("fse"), "Body should be FSE");
// Request full-screen from element not descendent from current FSE.
addFullscreenErrorContinuation(error1);
requestFullscreen(e("non-fse"));
}
function error1() {
- is(document.mozFullScreenElement, e("fse"), "FSE should not change");
+ is(document.fullscreenElement, e("fse"), "FSE should not change");
var iframe = e("subdoc");
enterFullscreen(iframe.contentDocument.body, change2);
}
function change2() {
var iframe = e("subdoc");
- is(document.mozFullScreenElement, iframe, "Subdoc container should be FSE.");
- is(iframe.contentDocument.mozFullScreenElement, iframe.contentDocument.body, "Subdoc body should be FSE in subdoc");
+ is(document.fullscreenElement, iframe, "Subdoc container should be FSE.");
+ is(iframe.contentDocument.fullscreenElement, iframe.contentDocument.body, "Subdoc body should be FSE in subdoc");
revertFullscreen(document, change3);
}
function change3() {
- is(document.mozFullScreenElement, e("fse"), "FSE should rollback to FSE.");
+ is(document.fullscreenElement, e("fse"), "FSE should rollback to FSE.");
revertFullscreen(document, change4);
}
function change4() {
- is(document.mozFullScreenElement, null, "Should have left full-screen entirely");
+ is(document.fullscreenElement, null, "Should have left full-screen entirely");
enterFullscreen(e("fse"), change5);
}
function change5() {
- is(document.mozFullScreenElement, e("fse"), "FSE should be e('fse')");
+ is(document.fullscreenElement, e("fse"), "FSE should be e('fse')");
enterFullscreen(e("fse-inner"), change6);
}
function change6() {
addFullscreenChangeContinuation("exit", change7);
var element = e('fse-inner');
- is(document.mozFullScreenElement, element, "FSE should be e('fse-inner')");
+ is(document.fullscreenElement, element, "FSE should be e('fse-inner')");
element.parentNode.removeChild(element);
}
function change7() {
- is(document.mozFullScreenElement, null, "Should have fully exited full-screen mode when removed FSE from doc");
+ is(document.fullscreenElement, null, "Should have fully exited full-screen mode when removed FSE from doc");
opener.nextTest();
}
</script>
</pre>
</body>
</html>
--- a/dom/html/test/file_fullscreen-scrollbar.html
+++ b/dom/html/test/file_fullscreen-scrollbar.html
@@ -61,17 +61,17 @@ function assertHasNoScrollbars(elem) {
var rect = getMeasureRect();
is(rect.width, screen.width,
`Should not have vertical scrollbar when ${elem} is in fullscreen`);
is(rect.height, screen.height,
`Should not have horizontal scrollbar when ${elem} is in fullscreen`);
}
function checkScrollbars(elem, shouldHaveScrollbars) {
- is(elem, document.mozFullScreenElement,
+ is(elem, document.fullscreenElement,
"Should only check the current fullscreen element");
var assertFunc = shouldHaveScrollbars ?
assertHasScrollbars : assertHasNoScrollbars;
assertFunc(elem);
triggerFrameReconstruction();
assertFunc(elem);
}
@@ -88,38 +88,38 @@ function begin() {
var rectInner = document.getElementById("ref-inner").getBoundingClientRect();
gVerticalScrollbarWidth = rectOuter.width - rectInner.width;
gHorizontalScrollbarWidth = rectOuter.height - rectInner.height;
ok(gVerticalScrollbarWidth != 0, "Should have vertical scrollbar");
ok(gHorizontalScrollbarWidth != 0, "Should have horizontal scrollbar");
info("Entering fullscreen on root");
addFullscreenChangeContinuation("enter", enteredFullscreenOnRoot);
- document.documentElement.mozRequestFullScreen();
+ document.documentElement.requestFullscreen();
}
function enteredFullscreenOnRoot() {
checkScrollbars(document.documentElement, true);
info("Entering fullscreen on div");
addFullscreenChangeContinuation("enter", enteredFullscreenOnDiv);
- gFullscreenDiv.mozRequestFullScreen();
+ gFullscreenDiv.requestFullscreen();
}
function enteredFullscreenOnDiv() {
checkScrollbars(gFullscreenDiv, false);
info("Exiting fullscreen on div");
addFullscreenChangeContinuation("exit", exitedFullscreenOnDiv);
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
function exitedFullscreenOnDiv() {
checkScrollbars(document.documentElement, true);
info("Exiting fullscreen on root");
addFullscreenChangeContinuation("exit", exitedFullscreenOnRoot);
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
function exitedFullscreenOnRoot() {
opener.nextTest();
}
</script>
</body>
--- a/dom/html/test/file_fullscreen-selector.html
+++ b/dom/html/test/file_fullscreen-selector.html
@@ -57,22 +57,22 @@ function getViewportRect() {
}
var fullscreenElems = [];
function checkFullscreenState(elem, hasState, viewportRect) {
var id = elem.id;
var rect = elem.getBoundingClientRect();
if (hasState) {
- ok(elem.matches(":-moz-full-screen"),
+ ok(elem.matches(":fullscreen"),
`${id} should match selector ":fullscreen"`);
ok(rectEquals(rect, viewportRect),
`The bounding rect of ${id} should match the viewport`);
} else {
- ok(!elem.matches(":-moz-full-screen"),
+ ok(!elem.matches(":fullscreen"),
`${id} should not match selector ":fullscreen"`);
ok(rectEquals(rect, elem.initialRect),
`The bounding rect of ${id} should match its initial state`);
}
}
function checkFullscreenStates(states) {
var viewportRect = getViewportRect();
@@ -86,77 +86,77 @@ function begin() {
fullscreenElems.push(document.getElementById('fullscreen1'));
fullscreenElems.push(document.getElementById('fullscreen2'));
var viewportRect = getViewportRect();
for (var elem of fullscreenElems) {
var rect = elem.getBoundingClientRect();
var id = elem.id;
elem.initialRect = rect;
- ok(!elem.matches(":-moz-full-screen"),
+ ok(!elem.matches(":fullscreen"),
`${id} should not match selector ":fullscreen"`);
ok(!rectEquals(elem.initialRect, viewportRect),
`The initial bounding rect of ${id} should not match the viewport`);
}
info("Entering fullscreen on fullscreen0");
addFullscreenChangeContinuation("enter", enter0);
- fullscreenElems[0].mozRequestFullScreen();
+ fullscreenElems[0].requestFullscreen();
}
function enter0() {
checkFullscreenStates([true, false, false]);
info("Entering fullscreen on fullscreen1");
addFullscreenChangeContinuation("enter", enter1);
- fullscreenElems[1].mozRequestFullScreen();
+ fullscreenElems[1].requestFullscreen();
}
function enter1() {
checkFullscreenStates([true, true, false]);
info("Entering fullscreen on fullscreen2");
addFullscreenChangeContinuation("enter", enter2);
- fullscreenElems[2].mozRequestFullScreen();
+ fullscreenElems[2].requestFullscreen();
}
function enter2() {
checkFullscreenStates([true, true, true]);
info("Leaving fullscreen on fullscreen2");
addFullscreenChangeContinuation("exit", exit2);
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
function exit2() {
checkFullscreenStates([true, true, false]);
info("Leaving fullscreen on fullscreen1");
addFullscreenChangeContinuation("exit", exit1);
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
function exit1() {
checkFullscreenStates([true, false, false]);
info("Leaving fullscreen on fullscreen0");
addFullscreenChangeContinuation("exit", exit0);
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
function exit0() {
checkFullscreenStates([false, false, false]);
info("Entering fullscreen on all elements");
var count = 0;
function listener() {
if (++count == 3) {
- document.removeEventListener("mozfullscreenchange", listener);
+ document.removeEventListener("fullscreenchange", listener);
enterAll();
}
}
- document.addEventListener("mozfullscreenchange", listener);
- fullscreenElems[0].mozRequestFullScreen();
- fullscreenElems[1].mozRequestFullScreen();
- fullscreenElems[2].mozRequestFullScreen();
+ document.addEventListener("fullscreenchange", listener);
+ fullscreenElems[0].requestFullscreen();
+ fullscreenElems[1].requestFullscreen();
+ fullscreenElems[2].requestFullscreen();
}
function enterAll() {
checkFullscreenStates([true, true, true]);
info("Fully-exiting fullscreen");
addFullscreenChangeContinuation("exit", exitAll);
synthesizeKey("VK_ESCAPE", {});
}
--- a/dom/html/test/file_fullscreen-svg-element.html
+++ b/dom/html/test/file_fullscreen-svg-element.html
@@ -27,23 +27,23 @@
/*
* Test for Bug 735031
* Test locking non-html element.
*/
function begin() {
var elem = document.getElementById("svg-elem")
, elemWasLocked = false;
- document.addEventListener("mozfullscreenchange", function (e) {
- if (document.mozFullScreenElement === elem) {
+ document.addEventListener("fullscreenchange", function (e) {
+ if (document.fullscreenElement === elem) {
elemWasLocked = true;
- document.mozCancelFullScreen();
+ document.exitFullscreen();
} else {
opener.ok(elemWasLocked, "Expected SVG elem to become locked.");
opener.nextTest();
}
}, false);
- elem.mozRequestFullScreen();
+ elem.requestFullscreen();
}
</script>
</pre>
</body>
</html>
--- a/dom/html/test/file_fullscreen-top-layer.html
+++ b/dom/html/test/file_fullscreen-top-layer.html
@@ -106,33 +106,33 @@ function begin() {
nextTest();
}
function nextTest() {
document.body.className = tests.shift();
// trigger a reflow to ensure the state of frames before fullscreen
gFullscreen.getBoundingClientRect();
- ok(!document.mozFullScreen, "Shouldn't be in fullscreen");
+ ok(!document.fullscreenElement, "Shouldn't be in fullscreen");
// check window snapshot
assertWindowPureColor(window, "red");
// simulate click
window.addEventListener("click", firstClick);
synthesizeMouseAtWindowCenter();
}
function firstClick(evt) {
window.removeEventListener("click", firstClick);
is(evt.target, gBack, "Click target should be #back before fullscreen");
addFullscreenChangeContinuation("enter", enterFullscreen);
- gFullscreen.mozRequestFullScreen();
+ gFullscreen.requestFullscreen();
}
function enterFullscreen() {
- ok(document.mozFullScreen, "Should now be in fullscreen");
+ ok(document.fullscreenElement, "Should now be in fullscreen");
// check window snapshot
assertWindowPureColor(window, "green");
// check computed style of #parent
const style = getComputedStyle(gParent);
for (var prop of gParentProperties) {
is(style[prop], gInitialVals[prop],
`Computed style ${prop} of #parent should not be changed`);
}
@@ -140,17 +140,17 @@ function enterFullscreen() {
window.addEventListener("click", secondClick);
synthesizeMouseAtWindowCenter();
}
function secondClick(evt) {
window.removeEventListener("click", secondClick);
is(evt.target, gFullscreen, "Click target should be #fullscreen now");
addFullscreenChangeContinuation("exit", exitFullscreen);
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
function exitFullscreen() {
if (tests.length > 0) {
nextTest();
} else {
opener.nextTest();
}
--- a/dom/html/test/file_fullscreen-utils.js
+++ b/dom/html/test/file_fullscreen-utils.js
@@ -35,48 +35,48 @@ function addFullscreenChangeContinuation
};
}
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
- // mozFullScreenElement first here. Note that we need to 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.mozFullScreenElement || inNormalMode(topWin);
+ 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("mozfullscreenchange", onFullscreenChange, false);
+ 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("mozfullscreenchange", onFullscreenChange, false);
+ doc.addEventListener("fullscreenchange", onFullscreenChange, false);
}
// Calls |callback| when the next fullscreenerror is dispatched to inDoc||document.
function addFullscreenErrorContinuation(callback, inDoc) {
var doc = inDoc || document;
var listener = function(event) {
- doc.removeEventListener("mozfullscreenerror", listener, false);
+ doc.removeEventListener("fullscreenerror", listener, false);
setTimeout(function(){callback(event);}, 0);
};
- doc.addEventListener("mozfullscreenerror", listener, false);
+ doc.addEventListener("fullscreenerror", listener, false);
}
--- a/dom/html/test/test_fullscreen-api-race.html
+++ b/dom/html/test/test_fullscreen-api-race.html
@@ -58,29 +58,29 @@ const ACTION_FUNCS = [
info("About to close the window");
win.close();
return Promise.resolve();
},
function exitFullscreen(win) {
info("About to cancel fullscreen");
var deferred = new Deferred();
function listener() {
- win.removeEventListener("mozfullscreenchange", listener);
- ok(!win.document.mozFullScreen, "Should exit fullscreen");
+ win.removeEventListener("fullscreenchange", listener);
+ ok(!win.document.fullscreenElement, "Should exit fullscreen");
ok(!win.fullScreen, "The window should no longer be in fullscreen");
win.close();
deferred.resolve();
}
- win.addEventListener("mozfullscreenchange", listener);
- win.document.mozCancelFullScreen();
+ win.addEventListener("fullscreenchange", listener);
+ win.document.exitFullscreen();
return deferred.promise;
},
function exitAndClose(win) {
info("About to cancel fullscreen and close the window");
- win.document.mozCancelFullScreen();
+ win.document.exitFullscreen();
win.close();
return Promise.resolve();
}
];
function* testGenerator() {
for (var openWinFunc of OPEN_WINDOW_FUNCS) {
for (var actionFunc of ACTION_FUNCS) {
@@ -93,41 +93,41 @@ function* testGenerator() {
function runTest(test) {
var win = test.openWinFunc();
return new Promise(resolve => {
SimpleTest.waitForFocus(resolve, win, true);
}).then(() => {
return new Promise((resolve, reject) => {
var retried = false;
function listener(evt) {
- if (!retried && evt.type == "mozfullscreenerror") {
+ if (!retried && evt.type == "fullscreenerror") {
todo(false, "Failed to enter fullscreen, but try again");
retried = true;
SimpleTest.waitForFocus(() => {
- win.document.documentElement.mozRequestFullScreen();
+ win.document.documentElement.requestFullscreen();
}, win, true);
return;
}
- win.removeEventListener("mozfullscreenchange", listener);
- win.removeEventListener("mozfullscreenerror", listener);
- is(evt.type, "mozfullscreenchange", "Should get fullscreenchange");
- ok(win.document.mozFullScreen, "Should have entered fullscreen");
+ win.removeEventListener("fullscreenchange", listener);
+ win.removeEventListener("fullscreenerror", listener);
+ is(evt.type, "fullscreenchange", "Should get fullscreenchange");
+ ok(win.document.fullscreenElement, "Should have entered fullscreen");
ok(win.fullScreen, "The window should be in fullscreen");
test.actionFunc(win).then(resolve);
}
if (win.fullScreen) {
todo(false, "Should not open in fullscreen mode");
win.close();
reject();
return;
}
info("About to enter fullscreen");
- win.addEventListener("mozfullscreenchange", listener);
- win.addEventListener("mozfullscreenerror", listener);
- win.document.documentElement.mozRequestFullScreen();
+ win.addEventListener("fullscreenchange", listener);
+ win.addEventListener("fullscreenerror", listener);
+ win.document.documentElement.requestFullscreen();
});
}).then(() => {
ok(win.closed, "The window should have been closed");
});
}
var tests = testGenerator();
--- a/dom/tests/mochitest/chrome/MozDomFullscreen_chrome.xul
+++ b/dom/tests/mochitest/chrome/MozDomFullscreen_chrome.xul
@@ -38,73 +38,73 @@ var gOuterDoc = null;
var gInnerDoc = null;
var gReceivedFullscreenEnteredEvent = false;
var gReceivedNewOriginEvent = false;
function firstEntry(event) {
if (event.type == "MozDOMFullscreen:Entered") {
window.removeEventListener("MozDOMFullscreen:Entered", firstEntry, false);
ok(!gReceivedFullscreenEnteredEvent, "MozDOMFullscreen:Entered shouldn't have been triggered twice");
- ok(event.target, gOuterDoc.body, "First MozDOMFullscreen:Entered should be targeted at outer body");
+ is(event.target, gOuterDoc.body, "First MozDOMFullscreen:Entered should be targeted at outer body");
gReceivedFullscreenEnteredEvent = true;
} else if (event.type == "MozDOMFullscreen:NewOrigin") {
window.removeEventListener("MozDOMFullscreen:NewOrigin", firstEntry, false);
ok(!gReceivedNewOriginEvent, "MozDOMFullscreen:NewOrigin shouldn't have been triggered twice");
- ok(event.target, gOuterDoc, "First MozDOMFullscreen:NewOrigin should be targeted at outer doc");
+ is(event.target, gOuterDoc, "First MozDOMFullscreen:NewOrigin should be targeted at outer doc");
gReceivedNewOriginEvent = true;
} else {
ok(false, "Unknown event received");
}
if (!gReceivedFullscreenEnteredEvent || !gReceivedNewOriginEvent) {
return;
}
- ok(gOuterDoc.mozFullScreenElement != null, "Outer doc should be in fullscreen");
+ ok(gOuterDoc.fullscreenElement != null, "Outer doc should be in fullscreen");
gInnerDoc = gOuterDoc.getElementById("innerFrame").contentDocument;
window.addEventListener("MozDOMFullscreen:NewOrigin", secondEntry, false);
gInnerDoc.defaultView.focus();
- gInnerDoc.body.mozRequestFullScreen();
+ gInnerDoc.body.requestFullscreen();
}
function secondEntry(event) {
is(event.target, gInnerDoc, "Second MozDOMFullscreen:NewOrigin should be targeted at inner doc");
- ok(gInnerDoc.mozFullScreenElement != null, "Inner doc should be in fullscreen");
+ ok(gInnerDoc.fullscreenElement != null, "Inner doc should be in fullscreen");
window.removeEventListener("MozDOMFullscreen:NewOrigin", secondEntry, false);
window.addEventListener("MozDOMFullscreen:NewOrigin", thirdEntry, false);
- gInnerDoc.mozCancelFullScreen();
+ gInnerDoc.exitFullscreen();
}
function thirdEntry(event) {
is(event.target, gOuterDoc, "Third MozDOMFullscreen:NewOrigin should be targeted at outer doc");
- ok(gOuterDoc.mozFullScreenElement != null, "Outer doc return to fullscreen after cancel fullscreen in inner doc");
+ ok(gOuterDoc.fullscreenElement != null, "Outer doc return to fullscreen after cancel fullscreen in inner doc");
window.removeEventListener("MozDOMFullscreen:NewOrigin", thirdEntry, false);
window.removeEventListener("MozDOMFullscreen:Exited", earlyExit, false);
window.addEventListener("MozDOMFullscreen:Exited", lastExit, false);
- gOuterDoc.mozCancelFullScreen();
+ gOuterDoc.exitFullscreen();
}
function earlyExit(event) {
ok(false, "MozDOMFullscreen:Exited should only be triggered after cancel all fullscreen");
}
function lastExit(event) {
is(event.target, gOuterDoc, "MozDOMFullscreen:Exited should be targeted at the last exited doc");
- ok(gOuterDoc.mozFullScreenElement == null, "Fullscreen should have been fully exited");
+ ok(gOuterDoc.fullscreenElement == null, "Fullscreen should have been fully exited");
window.opener.wrappedJSObject.done();
}
function start() {
SimpleTest.waitForFocus(
function() {
gBrowser = document.getElementById("browser");
gOuterDoc = gBrowser.contentDocument;
gBrowser.contentWindow.focus();
window.addEventListener("MozDOMFullscreen:Entered", firstEntry, false);
window.addEventListener("MozDOMFullscreen:NewOrigin", firstEntry, false);
- gOuterDoc.body.mozRequestFullScreen();
+ gOuterDoc.body.requestFullscreen();
});
}
]]>
</script>
<browser type="content" id="browser" width="400" height="400" src="file_MozDomFullscreen.html"/>
</window>
--- a/dom/tests/mochitest/pointerlock/file_allowPointerLockSandboxFlag.html
+++ b/dom/tests/mochitest/pointerlock/file_allowPointerLockSandboxFlag.html
@@ -41,17 +41,17 @@
function runTests () {
is(pointerLocked, 1, "Pointer should only have been locked once. " +
"Without allow-pointer-lock flag, a sandboxed document should not be " +
"able to lock the pointer");
SimpleTest.finish();
}
function resetIframe () {
- contentDocument.mozCancelFullScreen();
+ contentDocument.exitFullscreen();
// remove allow-pointer-lock sandbox flag
iframe.setAttribute("sandbox", "allow-scripts allow-same-origin");
// reloads the iframe, startTest function gets called again
iframe.setAttribute("src", "iframe_differentDOM.html");
}
function startTest () {
@@ -61,36 +61,36 @@
contentDocument = iframe.contentDocument;
iframeDiv = contentDocument.getElementById("div");
numberOfRuns++;
contentDocument.addEventListener("mozpointerlockchange", function () {
if (contentDocument.mozPointerLockElement === iframeDiv) {
pointerLocked++;
- contentDocument.mozCancelFullScreen();
+ contentDocument.exitFullscreen();
}
});
contentDocument.addEventListener("mozpointerlockerror", function () {
- contentDocument.mozCancelFullScreen();
+ contentDocument.exitFullscreen();
});
- contentDocument.addEventListener("mozfullscreenchange", function () {
- if (contentDocument.mozFullScreen) {
- ok(contentDocument.mozFullScreenElement === iframeDiv,
+ contentDocument.addEventListener("fullscreenchange", function () {
+ if (contentDocument.fullscreenElement) {
+ ok(contentDocument.fullscreenElement === iframeDiv,
"Fullscreen element can only be iframe div");
// during second run iframe won't have allow-pointer-lock flag and
// mozRequestPointerLock will fail, mozpointerlockerror should be fired
iframeDiv.mozRequestPointerLock();
} else if (numberOfRuns === 1) {
resetIframe();
} else if (numberOfRuns === 2) {
runTests();
}
});
- iframeDiv.mozRequestFullScreen();
+ iframeDiv.requestFullscreen();
}
</script>
</pre>
</body>
</html>
--- a/dom/tests/mochitest/pointerlock/file_childIframe.html
+++ b/dom/tests/mochitest/pointerlock/file_childIframe.html
@@ -103,39 +103,39 @@ https://bugzilla.mozilla.org/show_bug.cg
synthesizeMouseAtCenter(childDiv, {type: "mousemove"}, window);
};
var secondMoveChild = function (e) {
secondMove.mozMovementX = e.mozMovementX;
secondMove.mozMovementY = e.mozMovementY;
parent.removeEventListener("mousemove", secondMoveChild);
- document.mozCancelFullScreen();
+ document.exitFullscreen();
};
document.addEventListener("mozpointerlockchange", function () {
if (document.mozPointerLockElement === parent) {
parent.addEventListener("mousemove", firstMoveChild);
synthesizeMouseAtCenter(childDiv, {type: "mousemove"}, window);
}
}, false);
document.addEventListener("mozpointerlockerror", function () {
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}, false);
- document.addEventListener("mozfullscreenchange", function (e) {
- if (document.mozFullScreenElement === parent) {
+ document.addEventListener("fullscreenchange", function (e) {
+ if (document.fullscreenElement === parent) {
parent.mozRequestPointerLock();
}
else {
runTests();
SimpleTest.finish();
}
}, false);
function start() {
- parent.mozRequestFullScreen();
+ parent.requestFullscreen();
}
</script>
</pre>
</body>
</html>
--- a/dom/tests/mochitest/pointerlock/file_doubleLock.html
+++ b/dom/tests/mochitest/pointerlock/file_doubleLock.html
@@ -35,35 +35,35 @@ https://bugzilla.mozilla.org/show_bug.cg
function runTests () {
is(numberOfLocks, 2, "Requesting pointer lock on a locked element " +
"should dispatch mozpointerlockchange event");
}
document.addEventListener("mozpointerlockchange", function (e) {
if (document.mozPointerLockElement === div) {
if (numberOfLocks === 2) {
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
else {
numberOfLocks++;
div.mozRequestPointerLock();
}
}
}, false);
- document.addEventListener("mozfullscreenchange", function (e) {
- if (document.mozFullScreenElement === div) {
+ document.addEventListener("fullscreenchange", function (e) {
+ if (document.fullscreenElement === div) {
div.mozRequestPointerLock();
}
else {
runTests();
SimpleTest.finish();
}
}, false);
function start() {
console.log('started');
- div.mozRequestFullScreen();
+ div.requestFullscreen();
}
</script>
</pre>
</body>
</html>
--- a/dom/tests/mochitest/pointerlock/file_escapeKey.html
+++ b/dom/tests/mochitest/pointerlock/file_escapeKey.html
@@ -24,51 +24,51 @@
*/
SimpleTest.waitForExplicitFinish();
var div = document.getElementById("div")
, pointerUnLocked = false;
function start() {
- document.addEventListener("mozfullscreenchange", enteredFullscreen);
- div.mozRequestFullScreen();
+ document.addEventListener("fullscreenchange", enteredFullscreen);
+ div.requestFullscreen();
}
function enteredFullscreen(e) {
- document.removeEventListener("mozfullscreenchange", enteredFullscreen);
- is(document.mozFullScreenElement, div, "Element #div should entered fullscreen");
+ 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);
div.mozRequestPointerLock();
}
function lockedPointer(e) {
document.removeEventListener("mozpointerlockchange", lockedPointer);
is(document.mozPointerLockElement, div, "Pointer should have been locked on #div");
document.addEventListener("mozpointerlockchange", unlockedPointer);
- document.addEventListener("mozfullscreenchange", leavedFullscreen);
+ document.addEventListener("fullscreenchange", leavedFullscreen);
SimpleTest.executeSoon(() => synthesizeKey("VK_ESCAPE", {}));
}
var pointerUnlocked = false;
var exitedFullscreen = false;
function unlockedPointer() {
document.removeEventListener("mozpointerlockchange", unlockedPointer);
ok(!pointerUnlocked, "Shouldn't have unlocked pointer before");
ok(!document.mozPointerLockElement, "Pointer should have been unlocked now");
pointerUnlocked = true;
finishTest();
}
function leavedFullscreen() {
- document.removeEventListener("mozfullscreenchange", leavedFullscreen);
+ document.removeEventListener("fullscreenchange", leavedFullscreen);
ok(!exitedFullscreen, "Shouldn't have exited fullscreen before");
- ok(!document.mozFullScreenElement, "Should have exited fullscreen now");
+ ok(!document.fullscreenElement, "Should have exited fullscreen now");
exitedFullscreen = true;
finishTest();
}
function finishTest() {
if (pointerUnlocked && exitedFullscreen) {
SimpleTest.finish();
}
--- a/dom/tests/mochitest/pointerlock/file_infiniteMovement.html
+++ b/dom/tests/mochitest/pointerlock/file_infiniteMovement.html
@@ -60,17 +60,17 @@ https://bugzilla.mozilla.org/show_bug.cg
}
var secondMoveListener = function (e) {
info("Got second mousemove");
totalMovementX = divCenterWidth + ((divCenterWidth / 2) * 3);
totalMovementY = divCenterHeight + ((divCenterHeight / 2) * 3);
div.removeEventListener("mousemove", secondMoveListener, false);
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
document.addEventListener("mozpointerlockchange", function (e) {
if (document.mozPointerLockElement === div) {
info("Got mozpointerlockchange for entering");
div.addEventListener("mousemove", firstMoveListener, false);
divCenterWidth = Math.round(div.getBoundingClientRect().width / 2);
@@ -79,28 +79,28 @@ https://bugzilla.mozilla.org/show_bug.cg
synthesizeMouse(div, divCenterWidth, divCenterHeight, {
type: "mousemove"
}, window);
} else {
info("Got mozpointerlockchange for exiting");
}
}, false);
- document.addEventListener("mozfullscreenchange", function() {
- if (document.mozFullScreenElement === div) {
- info("Got mozfullscreenchange for entering");
+ document.addEventListener("fullscreenchange", function() {
+ if (document.fullscreenElement === div) {
+ info("Got fullscreenchange for entering");
div.mozRequestPointerLock();
}
else {
- info("Got mozfullscreenchange for exiting");
+ info("Got fullscreenchange for exiting");
runTests();
SimpleTest.finish();
}
}, false);
function start() {
info("Requesting fullscreen on parent");
- div.mozRequestFullScreen();
+ div.requestFullscreen();
}
</script>
</pre>
</body>
</html>
--- a/dom/tests/mochitest/pointerlock/file_locksvgelement.html
+++ b/dom/tests/mochitest/pointerlock/file_locksvgelement.html
@@ -31,34 +31,34 @@
*/
SimpleTest.waitForExplicitFinish(1);
var elem,
elemWasLocked = false;
document.addEventListener("mozpointerlockchange", function (e) {
- if (document.mozFullScreen &&
+ if (document.fullscreenElement &&
document.mozPointerLockElement === elem) {
elemWasLocked = true;
document.mozExitPointerLock();
} else {
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
}, false);
- document.addEventListener("mozfullscreenchange", function (e) {
- if (document.mozFullScreenElement === elem) {
+ 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");
- elem.mozRequestFullScreen();
+ elem.requestFullscreen();
}
</script>
</pre>
</body>
</html>
--- a/dom/tests/mochitest/pointerlock/file_movementXY.html
+++ b/dom/tests/mochitest/pointerlock/file_movementXY.html
@@ -78,43 +78,43 @@ https://bugzilla.mozilla.org/show_bug.cg
var moveMouseAgain = function(e) {
info("Got mouse move again");
secondMove.screenX = e.screenX;
secondMove.screenY = e.screenY;
secondMove.mozMovementX = e.mozMovementX;
secondMove.mozMovementY = e.mozMovementY;
div.removeEventListener("mousemove", moveMouseAgain, false);
- document.mozCancelFullScreen();
+ document.exitFullscreen();
};
function fullscreenchange() {
- if (document.mozFullScreenElement === div) {
- info("Got mozfullscreenchange for entering");
+ 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 mozfullscreenchange for exiting");
+ info("Got fullscreenchange for exiting");
runTests();
SimpleTest.finish();
}
}
- document.addEventListener("mozfullscreenchange", fullscreenchange, false);
+ document.addEventListener("fullscreenchange", fullscreenchange, false);
function start() {
info("Requesting fullscreen on parent");
- div.mozRequestFullScreen();
+ div.requestFullscreen();
}
</script>
</pre>
</body>
</html>
--- a/dom/tests/mochitest/pointerlock/file_nestedFullScreen.html
+++ b/dom/tests/mochitest/pointerlock/file_nestedFullScreen.html
@@ -44,37 +44,37 @@
isnot(pointerLocked, true, "Requesting fullscreen on " +
"childDiv while parentDiv still in fullscreen should " +
"unlock the pointer");
}
document.addEventListener("mozpointerlockchange", function (e) {
if (document.mozPointerLockElement === parentDiv) {
parentDivLocked = true;
- childDiv.mozRequestFullScreen();
+ childDiv.requestFullscreen();
}
}, false);
- document.addEventListener("mozfullscreenchange", function() {
- if (document.mozFullScreenElement === parentDiv) {
+ document.addEventListener("fullscreenchange", function() {
+ if (document.fullscreenElement === parentDiv) {
if (parentDivFullScreen === true) {
- document.mozCancelFullScreen();
+ document.exitFullscreen();
} else {
parentDivFullScreen = true;
parentDiv.mozRequestPointerLock();
}
}
- else if (document.mozFullScreenElement === childDiv) {
+ else if (document.fullscreenElement === childDiv) {
pointerLocked = !!document.mozPointerLockElement;
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
else {
runTests();
SimpleTest.finish();
}
}, false);
function start() {
- parentDiv.mozRequestFullScreen();
+ parentDiv.requestFullscreen();
}
</script>
</body>
</html>
--- a/dom/tests/mochitest/pointerlock/file_pointerLockPref.html
+++ b/dom/tests/mochitest/pointerlock/file_pointerLockPref.html
@@ -47,32 +47,32 @@
SpecialPowers.setBoolPref("full-screen-api.pointer-lock.enabled",
false );
div.mozRequestPointerLock();
}
}, false);
document.addEventListener("mozpointerlockerror", function (e) {
prefDisabled = true;
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}, false);
- document.addEventListener("mozfullscreenchange", function (e) {
- if (document.mozFullScreenElement === div) {
+ 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();
}
}, false);
function start() {
- div.mozRequestFullScreen();
+ div.requestFullscreen();
}
</script>
</pre>
</body>
</html>
--- a/dom/tests/mochitest/pointerlock/file_pointerlock-api.html
+++ b/dom/tests/mochitest/pointerlock/file_pointerlock-api.html
@@ -74,33 +74,33 @@
{ type: "contextmenu", button: 2 },
window);
document.addEventListener("mousemove", mouseMoveHandler, false);
synthesizeMouseAtCenter(div, {type: "mousemove"}, window);
} else {
info("Got mozpointerlockchange for exiting");
pointerUnlocked = true;
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
}, false);
- document.addEventListener("mozfullscreenchange", function(e) {
- if (document.mozFullScreenElement === div) {
- info("Got mozfullscreenchange for entering");
+ document.addEventListener("fullscreenchange", function(e) {
+ if (document.fullscreenElement === div) {
+ info("Got fullscreenchange for entering");
hasRequestPointerLock = "mozRequestPointerLock" in div;
div.mozRequestPointerLock();
} else {
- info("Got mozfullscreenchange for exiting");
+ info("Got fullscreenchange for exiting");
runTests();
SimpleTest.finish();
}
}, false);
function start() {
div = document.getElementById("div");
info("Requesting fullscreen on parent");
- div.mozRequestFullScreen();
+ div.requestFullscreen();
}
</script>
</pre>
</body>
</html>
--- a/dom/tests/mochitest/pointerlock/file_removedFromDOM.html
+++ b/dom/tests/mochitest/pointerlock/file_removedFromDOM.html
@@ -46,22 +46,22 @@ function checkPointerLockElement(elem) {
is(document.mozPointerLockElement, elem,
`#${elem.id} should have locked the pointer`);
} else {
ok(!document.mozPointerLockElement, "Pointer should have been unlocked");
}
}
function start() {
- listenOneDocEvent("mozfullscreenchange", enteredFullscreen);
- document.documentElement.mozRequestFullScreen();
+ listenOneDocEvent("fullscreenchange", enteredFullscreen);
+ document.documentElement.requestFullscreen();
}
function enteredFullscreen() {
- is(document.mozFullScreenElement, document.documentElement,
+ is(document.fullscreenElement, document.documentElement,
"Root element should have entered fullscreen");
listenOneDocEvent("mozpointerlockchange", lockedPointerOnDiv);
div.mozRequestPointerLock();
}
function lockedPointerOnDiv() {
checkPointerLockElement(div);
listenOneDocEvent("mozpointerlockchange", unlockedPointerFromDiv);
@@ -77,18 +77,18 @@ function unlockedPointerFromDiv() {
function lockedPointerOnInner() {
checkPointerLockElement(inner);
listenOneDocEvent("mozpointerlockchange", unlockedPointerFromInner);
document.body.removeChild(outer);
}
function unlockedPointerFromInner() {
checkPointerLockElement(null);
- listenOneDocEvent("mozfullscreenchange", exitedFullscreen);
- document.mozCancelFullScreen();
+ listenOneDocEvent("fullscreenchange", exitedFullscreen);
+ document.exitFullscreen();
}
function exitedFullscreen() {
SimpleTest.finish();
}
</script>
</pre>
</body>
--- a/dom/tests/mochitest/pointerlock/file_retargetMouseEvents.html
+++ b/dom/tests/mochitest/pointerlock/file_retargetMouseEvents.html
@@ -166,44 +166,44 @@ https://bugzilla.mozilla.org/show_bug.cg
var parentMoveTest = function (e) {
info("Got parent mousemove");
parentStats.mouseMove = true;
parent.removeEventListener("mousemove", parentMoveTest);
child.removeEventListener("mousemove", childMoveTest);
SimpleTest.executeSoon(function () {
info("Exit fullscreen");
- document.mozCancelFullScreen();
+ document.exitFullscreen();
});
}
document.addEventListener("mozpointerlockchange", function (e) {
if (document.mozPointerLockElement === parent) {
info("Got mozpointerlockchange for entering");
parent.addEventListener("mousemove", startMouseTests);
child.addEventListener("mousemove", childMoveTest);
SimpleTest.executeSoon(function () {
synthesizeMouseAtCenter(parent, {type: "mousemove"}, window);
});
} else {
info("Got mozpointerlockchange for exiting");
}
}, false);
- document.addEventListener("mozfullscreenchange", function (e) {
- if (document.mozFullScreenElement === parent) {
- info("Got mozfullscreenchange for entering");
+ document.addEventListener("fullscreenchange", function (e) {
+ if (document.fullscreenElement === parent) {
+ info("Got fullscreenchange for entering");
parent.mozRequestPointerLock();
} else {
- info("Got mozfullscreenchange for exiting");
+ info("Got fullscreenchange for exiting");
runTests();
SimpleTest.finish();
}
}, false);
function start() {
info("Requesting fullscreen on parent");
- parent.mozRequestFullScreen();
+ parent.requestFullscreen();
}
</script>
</pre>
</body>
</html>
--- a/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html
+++ b/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html
@@ -77,17 +77,17 @@ https://bugzilla.mozilla.org/show_bug.cg
isLocked = !!document.mozPointerLockElement;
lockedCoords = {
screenX: e.screenX,
screenY: e.screenY,
clientX: e.clientX,
clientY: e.clientY
};
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
document.addEventListener("mozpointerlockchange", function (e) {
if (document.mozPointerLockElement === div) {
info("Got mozpointerlockchange for entering");
div.removeEventListener("mousemove", moveUnlocked, false);
div.addEventListener("mousemove", moveLocked, false);
divRect = div.getBoundingClientRect();
@@ -96,39 +96,39 @@ https://bugzilla.mozilla.org/show_bug.cg
} else {
info("Got mozpointerlockchange for exiting");
}
}, false);
function fullscreenchange() {
var screenX = window.screenX;
var screenY = window.screenY;
- if (document.mozFullScreenElement === div) {
- info("Got mozfullscreenchange for entering");
+ 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 mozfullscreenchange for exiting");
+ info("Got fullscreenchange for exiting");
runTests();
SimpleTest.finish();
}
}
- document.addEventListener("mozfullscreenchange", fullscreenchange, false);
+ document.addEventListener("fullscreenchange", fullscreenchange, false);
function start() {
div = document.getElementById("div");
info("Requesting fullscreen on parent");
- div.mozRequestFullScreen();
+ div.requestFullscreen();
}
</script>
</body>
</html>
--- a/dom/tests/mochitest/pointerlock/file_suppressSomeMouseEvents.html
+++ b/dom/tests/mochitest/pointerlock/file_suppressSomeMouseEvents.html
@@ -132,30 +132,30 @@ https://bugzilla.mozilla.org/show_bug.cg
}
document.addEventListener("mozpointerlockchange", function (e) {
if (document.mozPointerLockElement === parent) {
addEventListeners();
synthesizeMouseAtCenter(child, { type: "mousemove" }, window);
}
else {
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
}, false);
- document.addEventListener("mozfullscreenchange", function() {
- if (document.mozFullScreenElement === parent) {
+ 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");
- parent.mozRequestFullScreen();
+ parent.requestFullscreen();
}
</script>
</body>
</html>
--- a/dom/tests/mochitest/pointerlock/file_targetOutOfFocus.html
+++ b/dom/tests/mochitest/pointerlock/file_targetOutOfFocus.html
@@ -43,28 +43,28 @@
input.addEventListener("focus", function() {
div.mozRequestPointerLock();
}, false);
document.addEventListener("mozpointerlockchange", function (e) {
if (document.mozPointerLockElement === div) {
divPointerLock = true;
- document.mozCancelFullScreen();
+ document.exitFullscreen();
}
}, false);
- document.addEventListener("mozfullscreenchange", function() {
- if (document.mozFullScreenElement === div) {
+ document.addEventListener("fullscreenchange", function() {
+ if (document.fullscreenElement === div) {
input.focus();
} else {
runTests();
SimpleTest.finish();
}
}, false);
function start() {
- div.mozRequestFullScreen();
+ div.requestFullscreen();
}
</script>
</pre>
</body>
</html>
--- a/toolkit/content/tests/widgets/test_videocontrols.html
+++ b/toolkit/content/tests/widgets/test_videocontrols.html
@@ -24,17 +24,17 @@ const videoWidth = 320;
const videoHeight = 240;
const videoDuration = 3.8329999446868896;
const playButtonWidth = 28;
const playButtonHeight = 28;
const muteButtonWidth = 33;
const muteButtonHeight = 28;
const durationWidth = 34;
-const fullscreenButtonWidth = document.mozFullScreenEnabled ? 28 : 0;
+const fullscreenButtonWidth = document.fullscreenEnabled ? 28 : 0;
const volumeSliderWidth = 32;
const scrubberWidth = videoWidth - playButtonWidth - durationWidth - muteButtonWidth - volumeSliderWidth - fullscreenButtonWidth;
const scrubberHeight = 28;
// Play button is on the bottom-left
const playButtonCenterX = 0 + Math.round(playButtonWidth / 2);
const playButtonCenterY = videoHeight - Math.round(playButtonHeight / 2);
// Mute button is on the bottom-right before the full screen button and volume slider