Bug 1327953 - Fix enabling the 'Restore Default Search Engines' button when removing a default engine, r=Standard8 a=jcristau
authorFlorian Quèze <florian@queze.net>
Mon, 30 Jan 2017 08:10:00 +0100
changeset 375780 0e1d4619f4c6e18f9add95dce45a6969f7310a00
parent 375779 a8eefd5c63efa9ed822399b161a702cdae2cf4f8
child 375781 e235e56f062a8bb2bfec3ea17fa098ecd422b476
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8, jcristau
bugs1327953
milestone53.0a2
Bug 1327953 - Fix enabling the 'Restore Default Search Engines' button when removing a default engine, r=Standard8 a=jcristau
browser/components/preferences/in-content/search.js
--- a/browser/components/preferences/in-content/search.js
+++ b/browser/components/preferences/in-content/search.js
@@ -392,19 +392,19 @@ EngineStore.prototype = {
     }
 
     let engineName = aEngine.name;
     let index = this._engines.findIndex(element => element.name == engineName);
 
     if (index == -1)
       throw new Error("invalid engine?");
 
-    this._engines.splice(index, 1);
+    let removedEngine = this._engines.splice(index, 1)[0];
 
-    if (this._defaultEngines.some(this._isSameEngine, this._engines[index]))
+    if (this._defaultEngines.some(this._isSameEngine, removedEngine))
       gSearchPane.showRestoreDefaults(true);
     gSearchPane.buildDefaultEngineDropDown();
     return index;
   },
 
   restoreDefaultEngines() {
     var added = 0;