tor-browser

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

browser_contentWindow.js (1087B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 "use strict";
      4 
      5 const CONTENT_WINDOW_URL = "https://example.com/";
      6 
      7 declTest("contentWindow null when inner window inactive", {
      8  matches: [CONTENT_WINDOW_URL + "*"],
      9  url: CONTENT_WINDOW_URL + "?1",
     10 
     11  async test(browser) {
     12    // If Fission is disabled, the pref is no-op.
     13    await SpecialPowers.pushPrefEnv({
     14      set: [["fission.bfcacheInParent", true]],
     15    });
     16 
     17    let parent = browser.browsingContext.currentWindowGlobal;
     18    let actorParent = parent.getActor("TestWindow");
     19 
     20    await actorParent.sendQuery("storeActor");
     21 
     22    let url = CONTENT_WINDOW_URL + "?2";
     23    let loaded = BrowserTestUtils.browserLoaded(browser, false, url);
     24    BrowserTestUtils.startLoadingURIString(browser, url);
     25    await loaded;
     26 
     27    let result = await actorParent.sendQuery("checkActor");
     28 
     29    is(result.status, "success", "Should succeed when bfcache is enabled");
     30    ok(
     31      result.valueIsNull,
     32      "Should get a null contentWindow when inner window is inactive"
     33    );
     34  },
     35 });