summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/referrer/browser_referrer_open_link_in_window_in_container.js
blob: 2ba17cd449bb8f7ce9fc0a580e54b3df59fd859a (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
36
37
38
39
// Tests referrer on context menu navigation - open link in new window.
// Selects "open link in new window" from the context menu.

// This test runs from a container tab. The new tab/window will be loaded in
// the same container.

function startNewWindowTestCase(aTestNumber) {
  info(
    "browser_referrer_open_link_in_window: " +
      getReferrerTestDescription(aTestNumber)
  );
  contextMenuOpened(gTestWindow, "testlink").then(function (aContextMenu) {
    newWindowOpened().then(function (aNewWindow) {
      BrowserTestUtils.firstBrowserLoaded(aNewWindow, false).then(function () {
        checkReferrerAndStartNextTest(
          aTestNumber,
          aNewWindow,
          null,
          startNewWindowTestCase,
          { userContextId: 1 }
        );
      });
    });

    doContextMenuCommand(gTestWindow, aContextMenu, "context-openlink");
  });
}

function test() {
  waitForExplicitFinish();

  SpecialPowers.pushPrefEnv(
    { set: [["privacy.userContext.enabled", true]] },
    function () {
      requestLongerTimeout(10); // slowwww shutdown on e10s
      startReferrerTest(startNewWindowTestCase, { userContextId: 1 });
    }
  );
}