tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_onbeforeunload_frame.js (1152B)


      1 "use strict";
      2 
      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(12);
      6 
      7 Services.scriptloader.loadSubScript(
      8  getRootDirectory(gTestPath) + "head_browser_onbeforeunload.js",
      9  this
     10 );
     11 
     12 add_task(async function () {
     13  await SpecialPowers.pushPrefEnv({
     14    set: [["dom.require_user_interaction_for_beforeunload", false]],
     15  });
     16 
     17  for (let actions of PERMUTATIONS) {
     18    info(
     19      `Testing frame actions: [${actions.map(action =>
     20        ACTION_NAMES.get(action)
     21      )}]`
     22    );
     23 
     24    for (let startIdx = 0; startIdx < FRAMES.length; startIdx++) {
     25      info(`Testing content reload from frame ${startIdx}`);
     26 
     27      await doTest(actions, startIdx, (tab, frames) => {
     28        return SpecialPowers.spawn(frames[startIdx], [], () => {
     29          let eventLoopSpun = false;
     30          SpecialPowers.Services.tm.dispatchToMainThread(() => {
     31            eventLoopSpun = true;
     32          });
     33 
     34          content.location.reload();
     35 
     36          return { eventLoopSpun };
     37        });
     38      });
     39    }
     40  }
     41 });
     42 
     43 add_task(async function cleanup() {
     44  await TabPool.cleanup();
     45 });