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:
- toolkit/modules/IgnoreLists.jsm
Changes:
===================================== toolkit/modules/IgnoreLists.jsm ===================================== @@ -8,19 +8,19 @@ const { XPCOMUtils } = ChromeUtils.import( );
XPCOMUtils.defineLazyModuleGetters(this, { - RemoteSettings: "resource://services-settings/remote-settings.js", RemoteSettingsClient: "resource://services-settings/RemoteSettingsClient.jsm", });
-var EXPORTED_SYMBOLS = ["IgnoreLists"]; +Cu.importGlobalProperties(["fetch"]);
-const SETTINGS_IGNORELIST_KEY = "hijack-blocklists"; +var EXPORTED_SYMBOLS = ["IgnoreLists"];
class IgnoreListsManager { + _ignoreListSettings = null; + async init() { - if (!this._ignoreListSettings) { - this._ignoreListSettings = RemoteSettings(SETTINGS_IGNORELIST_KEY); - } + // TODO: Restore the initialization, once we use only the local dumps for + // the remote settings. }
async getAndSubscribe(listener) { @@ -30,7 +30,7 @@ class IgnoreListsManager { const settings = await this._getIgnoreList();
// Listen for future updates after we first get the values. - this._ignoreListSettings.on("sync", listener); + this._ignoreListSettings?.on("sync", listener);
return settings; } @@ -70,6 +70,14 @@ class IgnoreListsManager { * could be obtained. */ async _getIgnoreListSettings(firstTime = true) { + if (!this._ignoreListSettings) { + const dump = await fetch( + "resource:///defaults/settings/main/hijack-blocklists.json" + ); + const { data } = await dump.json(); + return data; + } + let result = []; try { result = await this._ignoreListSettings.get({
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/2a2e87c3...