[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-102.9.0esr-12.5-1] fixup! Bug 31740: Remove some unnecessary RemoteSettings instances



Title: GitLab

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

Commits:

  • 2a2e87c3
    by Pier Angelo Vendrame at 2023-03-22T12:22:38+01:00
    fixup! Bug 31740: Remove some unnecessary RemoteSettings instances
    
    Bug 40788: Tor Browser is phoning home
    
    The hijack-list component is the only remaining one calling home.
    This is a temporary workaround, to use the remote settings.
    
    We should do something like this commit at a more generic level, for all
    RemoteSettings users.
    

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({
    

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits