summaryrefslogtreecommitdiffstats
path: root/toolkit/components/places/tests/chrome/browser_disableglobalhistory.xhtml
blob: aa525e6153ae7e4d0489443820072eee70ec934f (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
40
41
42
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>

<window title="Test disableglobalhistory attribute on remote browsers"
        onload="run_test()"
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>

  <browser id="inprocess_disabled" src="about:blank" type="content" disableglobalhistory="true" />
  <browser id="inprocess_enabled" src="about:blank" type="content" />

  <browser id="remote_disabled" src="about:blank" type="content" disableglobalhistory="true" />
  <browser id="remote_enabled" src="about:blank" type="content" />

  <script type="text/javascript">

  const { ContentTask } = ChromeUtils.importESModule(
    "resource://testing-common/ContentTask.sys.mjs"
  );
  ContentTask.setTestScope(window.arguments[0].wrappedJSObject);

  function expectUseGlobalHistory(id, expected) {
    let browser = document.getElementById(id);
    /* eslint-disable-next-line no-shadow */
    return ContentTask.spawn(browser, {id, expected}, function({id, expected}) {
      Assert.equal(docShell.browsingContext.useGlobalHistory, expected,
                   "Got the right useGlobalHistory state in the docShell of " + id);
    });
  }

  async function run_test() {
    await expectUseGlobalHistory("inprocess_disabled", false);
    await expectUseGlobalHistory("inprocess_enabled", true);

    await expectUseGlobalHistory("remote_disabled", false);
    await expectUseGlobalHistory("remote_enabled", true);
    window.arguments[0].done();
    ok(true);
  }

  </script>
</window>