Pier Angelo Vendrame pushed to branch base-browser-102.9.0esr-12.5-1 at The Tor Project / Applications / Tor Browser

Commits:

1 changed file:

Changes:

  • toolkit/modules/IgnoreLists.jsm
    ... ... @@ -8,19 +8,19 @@ const { XPCOMUtils } = ChromeUtils.import(
    8 8
     );
    
    9 9
     
    
    10 10
     XPCOMUtils.defineLazyModuleGetters(this, {
    
    11
    -  RemoteSettings: "resource://services-settings/remote-settings.js",
    
    12 11
       RemoteSettingsClient: "resource://services-settings/RemoteSettingsClient.jsm",
    
    13 12
     });
    
    14 13
     
    
    15
    -var EXPORTED_SYMBOLS = ["IgnoreLists"];
    
    14
    +Cu.importGlobalProperties(["fetch"]);
    
    16 15
     
    
    17
    -const SETTINGS_IGNORELIST_KEY = "hijack-blocklists";
    
    16
    +var EXPORTED_SYMBOLS = ["IgnoreLists"];
    
    18 17
     
    
    19 18
     class IgnoreListsManager {
    
    19
    +  _ignoreListSettings = null;
    
    20
    +
    
    20 21
       async init() {
    
    21
    -    if (!this._ignoreListSettings) {
    
    22
    -      this._ignoreListSettings = RemoteSettings(SETTINGS_IGNORELIST_KEY);
    
    23
    -    }
    
    22
    +    // TODO: Restore the initialization, once we use only the local dumps for
    
    23
    +    // the remote settings.
    
    24 24
       }
    
    25 25
     
    
    26 26
       async getAndSubscribe(listener) {
    
    ... ... @@ -30,7 +30,7 @@ class IgnoreListsManager {
    30 30
         const settings = await this._getIgnoreList();
    
    31 31
     
    
    32 32
         // Listen for future updates after we first get the values.
    
    33
    -    this._ignoreListSettings.on("sync", listener);
    
    33
    +    this._ignoreListSettings?.on("sync", listener);
    
    34 34
     
    
    35 35
         return settings;
    
    36 36
       }
    
    ... ... @@ -70,6 +70,14 @@ class IgnoreListsManager {
    70 70
        *   could be obtained.
    
    71 71
        */
    
    72 72
       async _getIgnoreListSettings(firstTime = true) {
    
    73
    +    if (!this._ignoreListSettings) {
    
    74
    +      const dump = await fetch(
    
    75
    +        "resource:///defaults/settings/main/hijack-blocklists.json"
    
    76
    +      );
    
    77
    +      const { data } = await dump.json();
    
    78
    +      return data;
    
    79
    +    }
    
    80
    +
    
    73 81
         let result = [];
    
    74 82
         try {
    
    75 83
           result = await this._ignoreListSettings.get({