brizental pushed to branch tor-browser-153.4.0esr-16.0-1 at The Tor Project / Applications / Tor Browser

Commits:

1 changed file:

Changes:

  • browser/components/extensions/parent/ext-browserAction.js
    ... ... @@ -304,12 +304,20 @@ this.browserAction = class extends ExtensionAPIPersistent {
    304 304
               const changeNoScriptVisibility = () => {
    
    305 305
                 node.hidden = Services.prefs.getBoolPref(HIDE_NO_SCRIPT_PREF, true);
    
    306 306
               };
    
    307
    -          // Since we expect the NoScript widget to only be destroyed on exit,
    
    308
    -          // we do not set up to remove the observer.
    
    309 307
               Services.prefs.addObserver(
    
    310 308
                 HIDE_NO_SCRIPT_PREF,
    
    311 309
                 changeNoScriptVisibility
    
    312 310
               );
    
    311
    +          document.defaultView.addEventListener(
    
    312
    +            "unload",
    
    313
    +            () => {
    
    314
    +              Services.prefs.removeObserver(
    
    315
    +                HIDE_NO_SCRIPT_PREF,
    
    316
    +                changeNoScriptVisibility
    
    317
    +              );
    
    318
    +            },
    
    319
    +            { once: true }
    
    320
    +          );
    
    313 321
               changeNoScriptVisibility();
    
    314 322
             }
    
    315 323