[tbb-commits] [tor-browser/tor-browser-81.0.1-10.0-1] Bug 31563: force reloading search extensions if extensions.enabledScopes has changed

sysrqb at torproject.org sysrqb at torproject.org
Wed Oct 7 03:51:51 UTC 2020


commit b02ad062c82c4d62d398043995dc1c016bd1cac9
Author: Alex Catarineu <acat at torproject.org>
Date:   Sat Aug 31 16:23:20 2019 +0200

    Bug 31563: force reloading search extensions if extensions.enabledScopes has changed
---
 toolkit/components/search/SearchCache.jsm   | 8 ++++++++
 toolkit/components/search/SearchService.jsm | 4 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/toolkit/components/search/SearchCache.jsm b/toolkit/components/search/SearchCache.jsm
index 017c29ee390e..511863bc76e0 100644
--- a/toolkit/components/search/SearchCache.jsm
+++ b/toolkit/components/search/SearchCache.jsm
@@ -208,6 +208,10 @@ class SearchCache {
     let locale = Services.locale.requestedLocale;
     let buildID = Services.appinfo.platformBuildID;
     let appVersion = Services.appinfo.version;
+    let enabledScopes = Services.prefs.getIntPref(
+      "extensions.enabledScopes",
+      -1
+    );
 
     // Allows us to force a cache refresh should the cache format change.
     cache.version = SearchUtils.CACHE_VERSION;
@@ -221,6 +225,10 @@ class SearchCache {
     cache.appVersion = appVersion;
     cache.locale = locale;
 
+    // Bug 31563: we want to force reloading engines if extensions.enabledScopes
+    // pref changes
+    cache.enabledScopes = enabledScopes;
+
     if (gModernConfig) {
       cache.builtInEngineList = this._searchService._searchOrder;
     } else {
diff --git a/toolkit/components/search/SearchService.jsm b/toolkit/components/search/SearchService.jsm
index 9c66b513ac8d..86fd01c3b10a 100644
--- a/toolkit/components/search/SearchService.jsm
+++ b/toolkit/components/search/SearchService.jsm
@@ -1017,7 +1017,9 @@ SearchService.prototype = {
       !cache.engines ||
       cache.version != SearchUtils.CACHE_VERSION ||
       cache.locale != Services.locale.requestedLocale ||
-      cache.buildID != buildID;
+      cache.buildID != buildID ||
+      cache.enabledScopes !=
+        Services.prefs.getIntPref("extensions.enabledScopes", -1);
 
     let enginesCorrupted = false;
     if (!rebuildCache) {





More information about the tbb-commits mailing list