Bug 1355746 - Part 4. Fix intermittent full screen test failures.
We found that a window will not get focus immediately after exiting full screen
mode on Linux. This seems to be a long-standing issue which surfaces due to the
change of background HTML parsing timing. So, we try to get focus everytime
before requesting full screen mode to ensure the request will not fail because
of the focus issue.
MozReview-Commit-ID: 2pOShFZcq8A
--- a/dom/html/test/file_fullscreen-api.html
+++ b/dom/html/test/file_fullscreen-api.html
@@ -300,17 +300,17 @@ function testNamespaces(followupTestFn)
addFullscreenErrorContinuation(() => {
ok(!document.fullscreenElement,
`Element named '${test.name}' in this namespace should not be allowed: ${test.ns}`);
document.body.removeChild(elem);
runNextNamespaceTest();
});
}
- elem.requestFullscreen();
+ SimpleTest.waitForFocus(() => elem.requestFullscreen());
}
runNextNamespaceTest();
}
</script>
</pre>
<div id="full-screen-element"></div>
</body>
--- a/dom/html/test/file_fullscreen-prefixed.html
+++ b/dom/html/test/file_fullscreen-prefixed.html
@@ -98,17 +98,17 @@ class TestCase {
this.changeListeners("remove", eventType, handleEvent);
TestCase.checkState(inFullscreen,
`${msg} in test case ${this.number}`);
resolve();
});
}
};
this.changeListeners("add", eventType, handleEvent);
- actionCallback();
+ SimpleTest.waitForFocus(() => actionCallback());
});
}
test() {
return new Promise(resolve => {
Promise.resolve().then(() => {
return this.doTest(() => div.mozRequestFullScreen(),
"fullscreenchange", true, "after request");