summaryrefslogtreecommitdiffstats
path: root/toolkit/components/places/tests/chrome/browser_disableglobalhistory.xul
blob: d7bbfda673bf27ba9d3f7949e415ddcc0b6b86eb (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
43
44
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>

<window title="Test disableglobalhistory attribute on remote browsers"
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  onload="run_test();">
  <script type="application/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
  <script type="application/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.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;version=1.7">
  const {interfaces: Ci, classes: Cc, results: Cr, utils: Cu} = Components;

  Cu.import("resource://testing-common/ContentTask.jsm");
  ContentTask.setTestScope(window.opener.wrappedJSObject);

  function expectUseGlobalHistory(id, expected) {
    let browser = document.getElementById(id);
    return ContentTask.spawn(browser, {id, expected}, function*({id, expected}) {
      Assert.equal(docShell.useGlobalHistory, expected,
                   "Got the right useGlobalHistory state in the docShell of " + id);
    });
  }

  function run_test() {
    spawn_task(function*() {
      yield expectUseGlobalHistory("inprocess_disabled", false);
      yield expectUseGlobalHistory("inprocess_enabled", true);

      yield expectUseGlobalHistory("remote_disabled", false);
      yield expectUseGlobalHistory("remote_enabled", true);
      window.opener.done();
    });
  };

  </script>
</window>