Verified Commit a6251e60 authored by cypherpunks1's avatar cypherpunks1 Committed by Pier Angelo Vendrame
Browse files

fixup! Bug 31740: Remove some unnecessary RemoteSettings instances

Bug 42730: Revert some changes
parent 712375db
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -198,17 +198,12 @@ function remoteSettingsFunction() {
      return;
    }
    // When running in full mode, we ignore last polling status.
    if (full || AppConstants.BASE_BROWSER_VERSION) {
    if (full) {
      lazy.gPrefs.clearUserPref(PREF_SETTINGS_SERVER_BACKOFF);
      lazy.gPrefs.clearUserPref(PREF_SETTINGS_LAST_UPDATE);
      lazy.gPrefs.clearUserPref(PREF_SETTINGS_LAST_ETAG);
    }

    if (AppConstants.BASE_BROWSER_VERSION) {
      // tor-browser#41704: pollChanges is always online, so do not allow it.
      return;
    }

    let pollTelemetryArgs = {
      source: TELEMETRY_SOURCE_POLL,
      trigger,
+7 −13
Original line number Diff line number Diff line
@@ -5,16 +5,18 @@
const lazy = {};

ChromeUtils.defineESModuleGetters(lazy, {
  RemoteSettings: "resource://services-settings/remote-settings.sys.mjs",
  RemoteSettingsClient:
    "resource://services-settings/RemoteSettingsClient.sys.mjs",
});

class IgnoreListsManager {
  _ignoreListSettings = null;
const SETTINGS_IGNORELIST_KEY = "hijack-blocklists";

class IgnoreListsManager {
  async init() {
    // TODO: Restore the initialization, once we use only the local dumps for
    // the remote settings.
    if (!this._ignoreListSettings) {
      this._ignoreListSettings = lazy.RemoteSettings(SETTINGS_IGNORELIST_KEY);
    }
  }

  async getAndSubscribe(listener) {
@@ -24,7 +26,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;
  }
@@ -65,14 +67,6 @@ 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({