Bug 1532997 - Properly await the default engines restoration process to finish, before refreshing the list in about:preferences. r=florian
authorMike de Boer <mdeboer@mozilla.com>
Fri, 15 Mar 2019 11:41:08 +0000
changeset 525081 b063e2b487b6691582a935b3a407abcd5bc26782
parent 525080 0b05d8817659edbbccb23a92be96105c2a0805c9
child 525082 3812d67603799766ab89a8ee5d4fdfd1c376d0ce
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian
bugs1532997
milestone67.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 1532997 - Properly await the default engines restoration process to finish, before refreshing the list in about:preferences. r=florian Differential Revision: https://phabricator.services.mozilla.com/D23646
browser/components/preferences/in-content/search.js
--- a/browser/components/preferences/in-content/search.js
+++ b/browser/components/preferences/in-content/search.js
@@ -314,18 +314,18 @@ var gSearchPane = {
                   aEvent.keyCode == KeyEvent.DOM_VK_BACK_SPACE &&
                   gEngineView.isEngineSelectedAndRemovable())) {
         // Delete and Shift+Backspace (Mac) removes selected engine.
         Services.search.removeEngine(gEngineView.selectedEngine.originalEngine);
      }
     }
   },
 
-  onRestoreDefaults() {
-    let num = gEngineView._engineStore.restoreDefaultEngines();
+  async onRestoreDefaults() {
+    let num = await gEngineView._engineStore.restoreDefaultEngines();
     gEngineView.rowCountChanged(0, num);
     gEngineView.invalidate();
   },
 
   showRestoreDefaults(aEnable) {
     document.getElementById("restoreDefaultSearchEngines").disabled = !aEnable;
   },
 
@@ -628,29 +628,29 @@ EngineView.prototype = {
 
   canDrop(targetIndex, orientation, dataTransfer) {
     var sourceIndex = this.getSourceIndexFromDrag(dataTransfer);
     return (sourceIndex != -1 &&
             sourceIndex != targetIndex &&
             sourceIndex != targetIndex + orientation);
   },
 
-  drop(dropIndex, orientation, dataTransfer) {
+  async drop(dropIndex, orientation, dataTransfer) {
     var sourceIndex = this.getSourceIndexFromDrag(dataTransfer);
     var sourceEngine = this._engineStore.engines[sourceIndex];
 
     const nsITreeView = Ci.nsITreeView;
     if (dropIndex > sourceIndex) {
       if (orientation == nsITreeView.DROP_BEFORE)
         dropIndex--;
     } else if (orientation == nsITreeView.DROP_AFTER) {
       dropIndex++;
     }
 
-    this._engineStore.moveEngine(sourceEngine, dropIndex);
+    await this._engineStore.moveEngine(sourceEngine, dropIndex);
     gSearchPane.showRestoreDefaults(true);
     gSearchPane.buildDefaultEngineDropDown();
 
     // Redraw, and adjust selection
     this.invalidate();
     this.selection.select(dropIndex);
   },