summaryrefslogtreecommitdiffstats
path: root/dom/base/test/fullscreen/test_fullscreen_modal.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/base/test/fullscreen/test_fullscreen_modal.html')
-rw-r--r--dom/base/test/fullscreen/test_fullscreen_modal.html11
1 files changed, 10 insertions, 1 deletions
diff --git a/dom/base/test/fullscreen/test_fullscreen_modal.html b/dom/base/test/fullscreen/test_fullscreen_modal.html
index 78e70d9052..fef4e3867d 100644
--- a/dom/base/test/fullscreen/test_fullscreen_modal.html
+++ b/dom/base/test/fullscreen/test_fullscreen_modal.html
@@ -21,7 +21,7 @@ const button = document.querySelector("button");
let clickCount = 0;
let lastFullscreenPromise = null;
let shouldEnterFullscreen = false;
-button.addEventListener("click", function(e) {
+button.addEventListener("click", function() {
clickCount++;
if (shouldEnterFullscreen) {
const fullscreenElement = document.getElementById("fullscreen");
@@ -58,6 +58,15 @@ async function testFullscreenIsModal(modal) {
ok(document.fullscreenElement.matches(":fullscreen"), "Fullscreen element matches :fullscreen");
is(document.fullscreenElement.matches(":modal"), modal, "Fullscreen element matches :modal");
+ // Before exiting fullscreen, wait on the document becoming active,
+ // which signifies that the fullscreen request has been completely
+ // processed. It is important that the fullscreen request is all
+ // the way done, or the exit fullscreen request could be dropped.
+ let documentWrapper = SpecialPowers.wrap(document);
+ await SimpleTest.promiseWaitForCondition(() => documentWrapper.isActive(),
+ "Timed out waiting for document to become active.");
+ ok(documentWrapper.isActive(), "Document is active.");
+
await document.exitFullscreen();
clickButton(/* expectEvent = */ true);
}