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 464410 b063e2b487b6
parent 464409 0b05d8817659
child 464411 3812d6760379
push id35716
push useraciure@mozilla.com
push dateSun, 17 Mar 2019 09:42:17 +0000
treeherdermozilla-central@8ee97c045359 [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);
   },