Bug 1549122: Duct tape to prevent deadlock when search extensions upgraded on startup. r=mikedeboer a=Aryx
authorDale Harvey <dale@arandomurl.com>
Mon, 06 May 2019 13:06:34 +0200
changeset 531476 a40e9f3da7aca0279d4a1b58f3bf87e169e24b58
parent 531475 c6d806b496845985516cc04342c04988aa1817dd
child 531477 df3eadfa74a8061f4c88496404d51baf47e21070
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer, Aryx
bugs1549122
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 1549122: Duct tape to prevent deadlock when search extensions upgraded on startup. r=mikedeboer a=Aryx Differential Revision: https://phabricator.services.mozilla.com//D30004
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
@@ -334,17 +334,18 @@ this.chrome_settings_overrides = class e
       chrome_settings_overrides.processDefaultSearchSetting("enable", extension.id);
     }
   }
 
   async addSearchEngine() {
     let {extension} = this;
     let isCurrent = false;
     let index = -1;
-    if (extension.startupReason === "ADDON_UPGRADE") {
+    if (extension.startupReason === "ADDON_UPGRADE" &&
+        !extension.addonData.builtIn) {
       let engines = await Services.search.getEnginesByExtensionID(extension.id);
       if (engines.length > 0) {
         let firstEngine = engines[0];
         let firstEngineName = firstEngine.name;
         // There can be only one engine right now
         isCurrent = (await Services.search.getDefault()).name == firstEngineName;
         // Get position of engine and store it
         index = (await Services.search.getEngines()).map(engine => engine.name).indexOf(firstEngineName);
@@ -353,17 +354,18 @@ this.chrome_settings_overrides = class e
     }
     try {
       let engines = await Services.search.addEnginesFromExtension(extension);
       if (engines.length > 0) {
         await ExtensionSettingsStore.addSetting(
           extension.id, DEFAULT_SEARCH_STORE_TYPE, ENGINE_ADDED_SETTING_NAME,
           engines[0].name);
       }
-      if (extension.startupReason === "ADDON_UPGRADE") {
+      if (extension.startupReason === "ADDON_UPGRADE" &&
+          !extension.addonData.builtIn) {
         let engines = await Services.search.getEnginesByExtensionID(extension.id);
         let engine = Services.search.getEngineByName(engines[0].name);
         if (isCurrent) {
           await Services.search.setDefault(engine);
         }
         if (index != -1) {
           await Services.search.moveEngine(engine, index);
         }