summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/test/xpinstall/browser_bug611242.js
blob: 08af331bda249dd2c07fc08352a09cd0172a2cd7 (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
// ----------------------------------------------------------------------------
// Test whether setting a new property in InstallTrigger then persists to other
// page loads
function loadURI(aUri, aCallback) {
  gBrowser.selectedBrowser.addEventListener("load", function() {
    if (gBrowser.selectedBrowser.currentURI.spec != aUri)
      return;

    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);

    aCallback();
  }, true);

  gBrowser.loadURI(aUri);
}

function test() {
  waitForExplicitFinish();

  gBrowser.selectedTab = gBrowser.addTab();

  loadURI(TESTROOT + "enabled.html", function() {
    window.content.wrappedJSObject.InstallTrigger.enabled.k = function() { };

    loadURI(TESTROOT2 + "enabled.html", function() {
      is(window.content.wrappedJSObject.InstallTrigger.enabled.k, undefined, "Property should not be defined");

      gBrowser.removeTab(gBrowser.selectedTab);

      finish();
    });
  });
}
// ----------------------------------------------------------------------------