Commit f19824d5 authored by Alex Catarineu's avatar Alex Catarineu Committed by Richard Pospesel
Browse files

Bug 31740: Remove some unnecessary RemoteSettings instances

More concretely, SearchService.jsm 'hijack-blocklists' and
url-classifier-skip-urls.

Avoid creating instance for 'anti-tracking-url-decoration'.

If prefs are disabling their usage, avoid creating instances for
'cert-revocations' and 'intermediates'.

Do not ship JSON dumps for collections we do not expect to need. For
the ones in the 'main' bucket, this prevents them from being synced
unnecessarily (the code in remote-settings does so for collections
in the main bucket for which a dump or local data exists). For the
collections in the other buckets, we just save some size by not
shipping their dumps.

We also clear the collections database on the v2 -> v3 migration.
parent 17645ecf
Loading
Loading
Loading
Loading
+0 −6
Changes for browser/components/search/SearchSERPTelemetry.jsm: 0 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -96,13 +96,7 @@ class TelemetryHandler {
      return;
    }

    this._telemetrySettings = RemoteSettings(TELEMETRY_SETTINGS_KEY);
    let rawProviderInfo = [];
    try {
      rawProviderInfo = await this._telemetrySettings.get();
    } catch (ex) {
      logConsole.error("Could not get settings:", ex);
    }

    // Send the provider info to the child handler.
    this._contentHandler.init(rawProviderInfo);
+1 −1
Changes for netwerk/url-classifier/UrlClassifierFeatureBase.cpp: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ void UrlClassifierFeatureBase::InitializePreferences() {

  nsCOMPtr<nsIUrlClassifierExceptionListService> exceptionListService =
      do_GetService("@mozilla.org/url-classifier/exception-list-service;1");
  if (NS_WARN_IF(!exceptionListService)) {
  if (!exceptionListService) {
    return;
  }

+0 −6
Changes for netwerk/url-classifier/components.conf: 0 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -13,10 +13,4 @@ Classes = [
        'constructor': 'mozilla::net::ChannelClassifierService::GetSingleton',
        'headers': ['mozilla/net/ChannelClassifierService.h'],
    },
    {
        'cid': '{b9f4fd03-9d87-4bfd-9958-85a821750ddc}',
        'contract_ids': ['@mozilla.org/url-classifier/exception-list-service;1'],
        'jsm': 'resource://gre/modules/UrlClassifierExceptionListService.jsm',
        'constructor': 'UrlClassifierExceptionListService',
    },
]
+23 −0
Changes for security/manager/ssl/RemoteSecuritySettings.jsm: 23 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -249,6 +249,16 @@ var RemoteSecuritySettings = {

class IntermediatePreloads {
  constructor() {
    this.maybeInit();
  }

  maybeInit() {
    if (
      this.client ||
      !Services.prefs.getBoolPref(INTERMEDIATES_ENABLED_PREF, true)
    ) {
      return;
    }
    this.client = RemoteSettings("intermediates", {
      bucketName: SECURITY_STATE_BUCKET,
      signerName: SECURITY_STATE_SIGNER,
@@ -274,6 +284,7 @@ class IntermediatePreloads {
      );
      return;
    }
    this.maybeInit();

    // Download attachments that are awaiting download, up to a max.
    const maxDownloadsPerRun = Services.prefs.getIntPref(
@@ -481,6 +492,16 @@ function compareFilters(filterA, filterB) {

class CRLiteFilters {
  constructor() {
    this.maybeInit();
  }

  maybeInit() {
    if (
      this.client ||
      !Services.prefs.getBoolPref(CRLITE_FILTERS_ENABLED_PREF, true)
    ) {
      return;
    }
    this.client = RemoteSettings("cert-revocations", {
      bucketName: SECURITY_STATE_BUCKET,
      signerName: SECURITY_STATE_SIGNER,
@@ -504,6 +525,8 @@ class CRLiteFilters {
      return;
    }

    this.maybeInit();

    let hasPriorFilter = await hasPriorData(
      Ci.nsICertStorage.DATA_TYPE_CRLITE_FILTER_FULL
    );
+4 −0
Changes for services/settings/IDBHelpers.jsm: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -188,6 +188,10 @@ async function openIDB(allowUpgrades = true) {
        });
      }
      if (event.oldVersion < 3) {
        // Clear existing stores for a fresh start
        transaction.objectStore("records").clear();
        transaction.objectStore("timestamps").clear();
        transaction.objectStore("collections").clear();
        // Attachment store
        db.createObjectStore("attachments", {
          keyPath: ["cid", "attachmentId"],
Loading