Bug 1352505 - Fix enabling the 'Restore Default Search Engines' button when removing a default engine. r?gijs draft
authorJared Wein <jwein@mozilla.com>
Fri, 31 Mar 2017 14:15:07 -0400
changeset 554496 e7ec4d6d3373058ef35e2c333370171fc3cbd344
parent 554488 7512be71da950790e454ac25bcd60026b45574a0
child 554514 ad6c7869a82a943ec19a37091531b48cd1200091
push id51955
push userbmo:jaws@mozilla.com
push dateFri, 31 Mar 2017 18:15:55 +0000
reviewersgijs
bugs1352505, 1327953, 1335907
milestone55.0a1
Bug 1352505 - Fix enabling the 'Restore Default Search Engines' button when removing a default engine. r?gijs Re-apply the patch from bug 1327953 since it got lost in the re-arrangement of preference code in bug 1335907. MozReview-Commit-ID: 1L4A2QC3Bns
browser/components/preferences/in-content/main.js
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -1071,19 +1071,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))
       gMainPane.showRestoreDefaults(true);
     gMainPane.buildDefaultEngineDropDown();
     return index;
   },
 
   restoreDefaultEngines() {
     var added = 0;