[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser] 39/65: Bug 31740: Remove some unnecessary RemoteSettings instances



This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch geckoview-102.4.0esr-11.5-1
in repository tor-browser.

commit 8603595da7e5470a1621ca4ac2709c5e2eea6e10
Author: Alex Catarineu <acat@xxxxxxxxxxxxxx>
AuthorDate: Wed Oct 16 23:01:12 2019 +0200

    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.
---
 browser/app/profile/000-tor-browser.js             |  3 +++
 browser/components/search/SearchSERPTelemetry.jsm  |  6 ------
 .../url-classifier/UrlClassifierFeatureBase.cpp    |  2 +-
 netwerk/url-classifier/components.conf             |  6 ------
 security/manager/ssl/RemoteSecuritySettings.jsm    | 23 ++++++++++++++++++++++
 services/settings/IDBHelpers.jsm                   |  4 ++++
 services/settings/dumps/blocklists/moz.build       | 14 +++++--------
 services/settings/dumps/main/moz.build             |  8 --------
 services/settings/dumps/security-state/moz.build   |  1 -
 .../components/antitracking/antitracking.manifest  |  2 +-
 toolkit/components/antitracking/components.conf    |  7 -------
 toolkit/components/search/SearchService.jsm        |  2 --
 12 files changed, 37 insertions(+), 41 deletions(-)

diff --git a/browser/app/profile/000-tor-browser.js b/browser/app/profile/000-tor-browser.js
index 77f8219fe622..41d7b8a0f0a2 100644
--- a/browser/app/profile/000-tor-browser.js
+++ b/browser/app/profile/000-tor-browser.js
@@ -141,6 +141,9 @@ pref("extensions.fxmonitor.enabled", false);
 pref("signon.management.page.mobileAndroidURL", "");
 pref("signon.management.page.mobileAppleURL", "");
 
+// Disable remote "password recipes"
+pref("signon.recipes.remoteRecipes.enabled", false);
+
 // Disable ServiceWorkers and push notifications by default
 pref("dom.serviceWorkers.enabled", false);
 pref("dom.push.enabled", false);
diff --git a/browser/components/search/SearchSERPTelemetry.jsm b/browser/components/search/SearchSERPTelemetry.jsm
index 2ec778078f8e..c8db269c8052 100644
--- a/browser/components/search/SearchSERPTelemetry.jsm
+++ b/browser/components/search/SearchSERPTelemetry.jsm
@@ -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);
diff --git a/netwerk/url-classifier/UrlClassifierFeatureBase.cpp b/netwerk/url-classifier/UrlClassifierFeatureBase.cpp
index 6f5924ab50af..6527dc05c0e4 100644
--- a/netwerk/url-classifier/UrlClassifierFeatureBase.cpp
+++ b/netwerk/url-classifier/UrlClassifierFeatureBase.cpp
@@ -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;
   }
 
diff --git a/netwerk/url-classifier/components.conf b/netwerk/url-classifier/components.conf
index 03a02f0ebeab..b2e667247317 100644
--- a/netwerk/url-classifier/components.conf
+++ b/netwerk/url-classifier/components.conf
@@ -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',
-    },
 ]
diff --git a/security/manager/ssl/RemoteSecuritySettings.jsm b/security/manager/ssl/RemoteSecuritySettings.jsm
index 891cb9a99ee8..9a10f0ccfc0e 100644
--- a/security/manager/ssl/RemoteSecuritySettings.jsm
+++ b/security/manager/ssl/RemoteSecuritySettings.jsm
@@ -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
     );
diff --git a/services/settings/IDBHelpers.jsm b/services/settings/IDBHelpers.jsm
index 5dc59c3687ef..010a5ea82987 100644
--- a/services/settings/IDBHelpers.jsm
+++ b/services/settings/IDBHelpers.jsm
@@ -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"],
diff --git a/services/settings/dumps/blocklists/moz.build b/services/settings/dumps/blocklists/moz.build
index 825fcd1f10f5..4ca18acd4ff6 100644
--- a/services/settings/dumps/blocklists/moz.build
+++ b/services/settings/dumps/blocklists/moz.build
@@ -8,15 +8,11 @@ with Files("**"):
     BUG_COMPONENT = ("Toolkit", "Blocklist Implementation")
 
 # The addons blocklist is also in mobile/android/installer/package-manifest.in
-if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
-    # Remove this once bug 1639050 is resolved.
-    FINAL_TARGET_FILES.defaults.settings.blocklists += ["addons.json"]
-else:
-    FINAL_TARGET_FILES.defaults.settings.blocklists += [
-        "addons-bloomfilters.json",
-        "gfx.json",
-        "plugins.json",
-    ]
+FINAL_TARGET_FILES.defaults.settings.blocklists += [
+    "addons-bloomfilters.json",
+    "gfx.json",
+    "plugins.json",
+]
 
 FINAL_TARGET_FILES.defaults.settings.blocklists["addons-bloomfilters"] += [
     "addons-bloomfilters/addons-mlbf.bin",
diff --git a/services/settings/dumps/main/moz.build b/services/settings/dumps/main/moz.build
index 8ff69de06687..6deac0b6f5bc 100644
--- a/services/settings/dumps/main/moz.build
+++ b/services/settings/dumps/main/moz.build
@@ -3,19 +3,11 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 FINAL_TARGET_FILES.defaults.settings.main += [
-    "anti-tracking-url-decoration.json",
-    "devtools-compatibility-browsers.json",
     "example.json",
     "hijack-blocklists.json",
     "language-dictionaries.json",
-    "password-recipes.json",
     "password-rules.json",
-    "search-config.json",
     "search-default-override-allowlist.json",
-    "search-telemetry-v2.json",
-    "sites-classification.json",
-    "top-sites.json",
-    "url-classifier-skip-urls.json",
     "websites-with-shared-credential-backends.json",
 ]
 
diff --git a/services/settings/dumps/security-state/moz.build b/services/settings/dumps/security-state/moz.build
index 9133cd4e3ed6..0d250ecddbe8 100644
--- a/services/settings/dumps/security-state/moz.build
+++ b/services/settings/dumps/security-state/moz.build
@@ -3,7 +3,6 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 FINAL_TARGET_FILES.defaults.settings["security-state"] += [
-    "intermediates.json",
     "onecrl.json",
 ]
 
diff --git a/toolkit/components/antitracking/antitracking.manifest b/toolkit/components/antitracking/antitracking.manifest
index 5eb37f9a3f99..872e6af07575 100644
--- a/toolkit/components/antitracking/antitracking.manifest
+++ b/toolkit/components/antitracking/antitracking.manifest
@@ -1 +1 @@
-category profile-after-change URLDecorationAnnotationsService @mozilla.org/tracking-url-decoration-service;1 process=main
+# category profile-after-change URLDecorationAnnotationsService @mozilla.org/tracking-url-decoration-service;1 process=main
diff --git a/toolkit/components/antitracking/components.conf b/toolkit/components/antitracking/components.conf
index 0357c874bb8d..9e61c20ebad4 100644
--- a/toolkit/components/antitracking/components.conf
+++ b/toolkit/components/antitracking/components.conf
@@ -11,13 +11,6 @@ Classes = [
         'jsm': 'resource://gre/modules/TrackingDBService.jsm',
         'constructor': 'TrackingDBService',
     },
-    {
-        'cid': '{5874af6d-5719-4e1b-b155-ef4eae7fcb32}',
-        'contract_ids': ['@mozilla.org/tracking-url-decoration-service;1'],
-        'jsm': 'resource://gre/modules/URLDecorationAnnotationsService.jsm',
-        'constructor': 'URLDecorationAnnotationsService',
-        'processes': ProcessSelector.MAIN_PROCESS_ONLY,
-    },
     {
         'cid': '{90d1fd17-2018-4e16-b73c-a04a26fa6dd4}',
         'contract_ids': ['@mozilla.org/purge-tracker-service;1'],
diff --git a/toolkit/components/search/SearchService.jsm b/toolkit/components/search/SearchService.jsm
index 27c9bf0d522d..db0f878886cc 100644
--- a/toolkit/components/search/SearchService.jsm
+++ b/toolkit/components/search/SearchService.jsm
@@ -247,8 +247,6 @@ SearchService.prototype = {
       // See if we have a settings file so we don't have to parse a bunch of XML.
       let settings = await this._settings.get();
 
-      this._setupRemoteSettings().catch(Cu.reportError);
-
       await this._loadEngines(settings);
 
       // If we've got this far, but the application is now shutting down,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits