Unverified Commit a19279e3 authored by Alex Catarineu's avatar Alex Catarineu Committed by Matthew Finkel
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 ecdc22b3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ void UrlClassifierFeatureBase::InitializePreferences() {

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

+0 −6
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/skip-list-service;1'],
        'jsm': 'resource://gre/modules/UrlClassifierSkipListService.jsm',
        'constructor': 'UrlClassifierSkipListService',
    },
]
+22 −0
Original line number Diff line number Diff line
@@ -350,6 +350,16 @@ var RemoteSecuritySettings = {

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

  maybeInit() {
    if (
      this.client ||
      !Services.prefs.getBoolPref(INTERMEDIATES_ENABLED_PREF, true)
    ) {
      return;
    }
    this.client = RemoteSettings(
      Services.prefs.getCharPref(INTERMEDIATES_COLLECTION_PREF),
      {
@@ -379,6 +389,7 @@ class IntermediatePreloads {
      );
      return;
    }
    this.maybeInit();

    // Download attachments that are awaiting download, up to a max.
    const maxDownloadsPerRun = Services.prefs.getIntPref(
@@ -704,6 +715,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(
      Services.prefs.getCharPref(CRLITE_FILTERS_COLLECTION_PREF),
      {
@@ -729,6 +750,7 @@ class CRLiteFilters {
      );
      return;
    }
    this.maybeInit();
    let current = await this.client.db.list();
    let fullFilters = current.filter(filter => !filter.incremental);
    if (fullFilters.length < 1) {
+4 −0
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"],
+0 −1
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@ with Files('**'):

# The addons blocklist is also in mobile/android/installer/package-manifest.in
FINAL_TARGET_FILES.defaults.settings.blocklists += ['addons-bloomfilters.json',
                                                    'addons.json',
                                                    'gfx.json',
                                                    'plugins.json']

Loading