summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/test/xpinstall/browser_bug611242.js
blob: 98cf433f6f6b34d28712aed4be899bd0a13190e4 (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
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.startLoadingURIString(
        browser,
        TESTROOT2 + "enabled.html"
      );
      await BrowserTestUtils.browserLoaded(browser);
      await SpecialPowers.spawn(browser, [], () => {
        is(
          content.wrappedJSObject.InstallTrigger.enabled.k,
          undefined,
          "Property should not be defined"
        );
      });
    }
  );
});
// ----------------------------------------------------------------------------