summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/test/xpinstall/browser_bug611242.js
blob: 75e1a4e0133011d82858223eb98303a0bf006c8a (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
// ----------------------------------------------------------------------------
// Test whether setting a new property in InstallTrigger then persists to other
// page loads
add_task(async function test() {
  await SpecialPowers.pushPrefEnv({
    set: [
      ["extensions.InstallTrigger.enabled", true],
      ["extensions.InstallTriggerImpl.enabled", true],
    ],
  });

  await BrowserTestUtils.withNewTab(
    { gBrowser, url: TESTROOT + "enabled.html" },
    async function (browser) {
      await SpecialPowers.spawn(browser, [], () => {
        content.wrappedJSObject.InstallTrigger.enabled.k = function () {};
      });

      BrowserTestUtils.loadURIString(browser, TESTROOT2 + "enabled.html");
      await BrowserTestUtils.browserLoaded(browser);
      await SpecialPowers.spawn(browser, [], () => {
        is(
          content.wrappedJSObject.InstallTrigger.enabled.k,
          undefined,
          "Property should not be defined"
        );
      });
    }
  );
});
// ----------------------------------------------------------------------------