browser_fullscreen-tab-close.js (1744B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 requestLongerTimeout(2); 7 8 // Import helpers 9 Services.scriptloader.loadSubScript( 10 "chrome://mochitests/content/browser/dom/base/test/fullscreen/fullscreen_helpers.js", 11 this 12 ); 13 14 add_setup(async function () { 15 await pushPrefs( 16 ["test.wait300msAfterTabSwitch", true], 17 ["full-screen-api.transition-duration.enter", "0 0"], 18 ["full-screen-api.transition-duration.leave", "0 0"], 19 ["full-screen-api.allow-trusted-requests-only", false] 20 ); 21 }); 22 23 TEST_URLS.forEach(url => { 24 add_task(async () => { 25 info(`url: ${url}`); 26 await BrowserTestUtils.withNewTab( 27 { 28 gBrowser, 29 url, 30 }, 31 async function (browser) { 32 let promiseFsState = waitForFullscreenState(document, true); 33 // Trigger click event in inner most iframe 34 SpecialPowers.spawn( 35 browser.browsingContext.children[0].children[0], 36 [], 37 function () { 38 content.setTimeout(() => { 39 content.document.getElementById("div").click(); 40 }, 0); 41 } 42 ); 43 await promiseFsState; 44 45 let promiseFsExit = waitForFullscreenExit(document, false); 46 // This should exit fullscreen 47 let tab = gBrowser.getTabForBrowser(browser); 48 BrowserTestUtils.removeTab(tab); 49 await promiseFsExit; 50 51 // Ensure the browser exits fullscreen state. 52 ok(!window.fullScreen, "The chrome window should not be in fullscreen"); 53 ok( 54 !document.documentElement.hasAttribute("inDOMFullscreen"), 55 "The chrome document should not be in fullscreen" 56 ); 57 } 58 ); 59 }); 60 });