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

gk at torproject.org gk at torproject.org
Tue Sep 15 15:12:11 UTC 2020


commit e2a2fee90e2b21d74940a6b43b9bba0ac1538d67
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