Bug 1544965 only remove search engines for an extension if the extension actually has one r=rpl
authorShane Caraveo <scaraveo@mozilla.com>
Wed, 01 May 2019 14:55:12 +0000
changeset 472130 0ec1e2ef404db0cafa7a670ca20b01c8e0e60dd6
parent 472129 62b63caf1a90ddb85d4ce1057cc7647a25ecd0d0
child 472131 bd72af1908de9418fcd1ca1b1b702db6ce0cb737
push id35948
push usernerli@mozilla.com
push dateWed, 01 May 2019 21:55:33 +0000
treeherdermozilla-central@c7a22f0ea7b4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrpl
bugs1544965
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1544965 only remove search engines for an extension if the extension actually has one r=rpl Differential Revision: https://phabricator.services.mozilla.com/D29411
browser/components/extensions/parent/ext-chrome-settings-overrides.js
--- a/browser/components/extensions/parent/ext-chrome-settings-overrides.js
+++ b/browser/components/extensions/parent/ext-chrome-settings-overrides.js
@@ -127,17 +127,20 @@ this.chrome_settings_overrides = class e
     }
     // We can call removeEngine in nsSearchService startup, if so we dont
     // need to reforward the call, just disable the web extension.
     if (!Services.search.isInitialized) {
       return;
     }
 
     try {
-      await Services.search.removeWebExtensionEngine(id);
+      let engines = await Services.search.getEnginesByExtensionID(id);
+      if (engines.length > 0) {
+        await Services.search.removeWebExtensionEngine(id);
+      }
     } catch (e) {
       Cu.reportError(e);
     }
   }
 
   static removeSearchSettings(id) {
     return Promise.all([
       this.processDefaultSearchSetting("removeSetting", id),