3 // We need to test a lot of permutations here, and there isn't any sensible way
4 // to split them up or run them faster.
5 requestLongerTimeout(6);
7 Services.scriptloader.loadSubScript(
8 getRootDirectory(gTestPath) + "head_browser_onbeforeunload.js",
12 add_task(async function () {
13 await SpecialPowers.pushPrefEnv({
14 set: [["dom.require_user_interaction_for_beforeunload", false]],
17 for (let actions of PERMUTATIONS) {
19 `Testing frame actions: [${actions.map(action =>
20 ACTION_NAMES.get(action)
24 info(`Testing tab close from parent process`);
25 await doTest(actions, -1, (tab, frames) => {
26 let eventLoopSpun = false;
27 Services.tm.dispatchToMainThread(() => {
31 BrowserTestUtils.removeTab(tab);
33 let result = { eventLoopSpun };
35 // Make an extra couple of trips through the event loop to give us time
36 // to process SpecialPowers.spawn responses before resolving.
37 return new Promise(resolve => {
39 executeSoon(() => resolve(result));
46 add_task(async function cleanup() {
47 await TabPool.cleanup();