[tbb-commits] [Git][tpo/applications/tor-browser][base-browser-102.9.0esr-12.5-1] fixup! Bug 31740: Remove some unnecessary RemoteSettings instances
Pier Angelo Vendrame (@pierov)
git at gitlab.torproject.org
Wed Mar 22 11:24:00 UTC 2023
Pier Angelo Vendrame pushed to branch base-browser-102.9.0esr-12.5-1 at The Tor Project / Applications / Tor Browser
Commits:
e7da6e7c by Pier Angelo Vendrame at 2023-03-22T11:23:57+00: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.
(cherry picked from commit 2a2e87c3dbc2a98a9ff6387dd278cb2643323b6d)
- - - - -
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/e7da6e7c5afb16b0a348f0c9193a8fa662daaee2
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/e7da6e7c5afb16b0a348f0c9193a8fa662daaee2
You're receiving this email because of your account on gitlab.torproject.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20230322/9cff61be/attachment-0001.htm>
More information about the tbb-commits
mailing list