diff --git a/dom/html/test/file_fullscreen-featurePolicy-inner.html b/dom/html/test/file_fullscreen-featurePolicy-inner.html
index 1ec3b2862d97..da94f7dedf2b 100644
--- a/dom/html/test/file_fullscreen-featurePolicy-inner.html
+++ b/dom/html/test/file_fullscreen-featurePolicy-inner.html
@@ -10,14 +10,17 @@ function doRequestFullscreen() {
document.removeEventListener("fullscreenchange", handler);
document.removeEventListener("fullscreenerror", handler);
if (evt.type == "fullscreenchange") {
+ document.addEventListener("fullscreenchange", () => parent.continueTest(evt.type), {once: true});
document.exitFullscreen();
+ } else {
+ parent.continueTest(evt.type);
}
- parent.continueTest(evt.type);
}
parent.ok(document.fullscreenEnabled, "Fullscreen " +
`should be enabled in ${parent.testTargetName}`);
document.addEventListener("fullscreenchange", handler);
document.addEventListener("fullscreenerror", handler);
+ parent.opener.info("Requesting fullscreen");
document.documentElement.requestFullscreen();
}
diff --git a/dom/html/test/file_fullscreen-featurePolicy.html b/dom/html/test/file_fullscreen-featurePolicy.html
index 349138b4d5e3..f35bf31bcff9 100644
--- a/dom/html/test/file_fullscreen-featurePolicy.html
+++ b/dom/html/test/file_fullscreen-featurePolicy.html
@@ -55,6 +55,7 @@ function nextTest() {
}
let test = tests.shift();
+ opener.info("Running " + test[0]);
// Create an iframe with an allowfullscreen and with an allow attribute.
// The request should be denied or allowed, based on the current test.
diff --git a/dom/html/test/mochitest.ini b/dom/html/test/mochitest.ini
index 356b9b9250b2..54220b8cd90c 100644
--- a/dom/html/test/mochitest.ini
+++ b/dom/html/test/mochitest.ini
@@ -437,7 +437,7 @@ skip-if = toolkit == 'android'
[test_formelements.html]
[test_fullscreen-api.html]
tags = fullscreen
-skip-if = toolkit == 'android' || (os == 'linux' && !debug) # linux opt/pgo timeouts: bug 1504062
+skip-if = toolkit == 'android'
support-files =
file_fullscreen-api.html
file_fullscreen-backdrop.html
diff --git a/dom/html/test/test_fullscreen-api.html b/dom/html/test/test_fullscreen-api.html
index 869c624cf399..728e8304efb9 100644
--- a/dom/html/test/test_fullscreen-api.html
+++ b/dom/html/test/test_fullscreen-api.html
@@ -60,9 +60,15 @@ function finish() {
function nextTest() {
if (testWindow) {
+ info("Waiting for focus to return to main window");
+ window.addEventListener("focus", function() {
+ info("main window focused, starting next test");
+ SimpleTest.executeSoon(runNextTest);
+ }, {once: true});
testWindow.close();
+ } else {
+ SimpleTest.executeSoon(runNextTest);
}
- SimpleTest.executeSoon(runNextTest);
}
var gHeadlessSkipList = [
@@ -130,10 +136,12 @@ function runNextTest() {
waitForLoadAndPaint(testWindow, function() {
SimpleTest.waitForFocus(function() {
SimpleTest.waitForFocus(function() {
+ info("Were focused");
// For the platforms that support reporting occlusion state (e.g. Mac),
// we should wait until the docshell has been activated again,
// otherwise, the fullscreen request might be denied.
if (testWindow.document.hidden) {
+ info("Waiting for document to unhide");
waitForEvent(testWindow.document, "visibilitychange", (event) => {
return !testWindow.document.hidden;
}, testWindow.begin);