Commit 4ef5a05d authored by brizental's avatar brizental
Browse files

fixup! BB 41581: Hide NoScript extension's toolbar button by default.

The widget is created once per browser window, so the extensions.hideNoScript
pref observer was added for every window and never removed. It kept each
closed window alive until shutdown. Remove it when the window unloads.
parent 66990fc7
Loading
Loading
Loading
Loading
Loading
+10 −2
Changes for browser/components/extensions/parent/ext-browserAction.js: 10 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -304,12 +304,20 @@ this.browserAction = class extends ExtensionAPIPersistent {
          const changeNoScriptVisibility = () => {
            node.hidden = Services.prefs.getBoolPref(HIDE_NO_SCRIPT_PREF, true);
          };
          // Since we expect the NoScript widget to only be destroyed on exit,
          // we do not set up to remove the observer.
          Services.prefs.addObserver(
            HIDE_NO_SCRIPT_PREF,
            changeNoScriptVisibility
          );
          document.defaultView.addEventListener(
            "unload",
            () => {
              Services.prefs.removeObserver(
                HIDE_NO_SCRIPT_PREF,
                changeNoScriptVisibility
              );
            },
            { once: true }
          );
          changeNoScriptVisibility();
        }