summaryrefslogtreecommitdiffstats
path: root/browser/extensions/report-site-issue/test/browser/browser_disabled_cleanup.js
blob: 65b6ff73699ac9b32d9c7774234fde99e689d112 (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
"use strict";

// Test the addon is cleaning up after itself when disabled.
add_task(async function test_disabled() {
  await promiseAddonEnabled();

  SpecialPowers.Services.prefs.setBoolPref(PREF_WC_REPORTER_ENABLED, false);

  await BrowserTestUtils.withNewTab(
    { gBrowser, url: "http://example.com" },
    async function () {
      const menu = new HelpMenuHelper();
      await menu.open();
      is(
        menu.isItemHidden(),
        true,
        "Report Site Issue help menu item is hidden."
      );
      await menu.close();
    }
  );

  await promiseAddonEnabled();

  await BrowserTestUtils.withNewTab(
    { gBrowser, url: "http://example.com" },
    async function () {
      const menu = new HelpMenuHelper();
      await menu.open();
      is(
        await menu.isItemHidden(),
        false,
        "Report Site Issue help menu item is visible."
      );
      await menu.close();
    }
  );

  // Shut down the addon at the end,or the new instance started when we re-enabled it will "leak".
  SpecialPowers.Services.prefs.setBoolPref(PREF_WC_REPORTER_ENABLED, false);
});