summaryrefslogtreecommitdiffstats
path: root/dom/ipc/tests/JSWindowActor/browser_contentWindow.js
blob: 7706a20934cbdde0e914591e8cbf4cff768ae418 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";

const CONTENT_WINDOW_URL = "https://example.com/";

declTest("contentWindow null when inner window inactive", {
  matches: [CONTENT_WINDOW_URL + "*"],
  url: CONTENT_WINDOW_URL + "?1",

  async test(browser) {
    // If Fission is disabled, the pref is no-op.
    await SpecialPowers.pushPrefEnv({
      set: [["fission.bfcacheInParent", true]],
    });

    let parent = browser.browsingContext.currentWindowGlobal;
    let actorParent = parent.getActor("TestWindow");

    await actorParent.sendQuery("storeActor");

    let url = CONTENT_WINDOW_URL + "?2";
    let loaded = BrowserTestUtils.browserLoaded(browser, false, url);
    await BrowserTestUtils.loadURIString(browser, url);
    await loaded;

    let result = await actorParent.sendQuery("checkActor");

    is(result.status, "success", "Should succeed when bfcache is enabled");
    ok(
      result.valueIsNull,
      "Should get a null contentWindow when inner window is inactive"
    );
  },
});