Bug 1122493 - reset alias to prevent reappear keywords when restoring default search engines. r=Florian
authorAbdelrhman Ahmed <a.ahmed1026@gmail.com>
Tue, 10 Feb 2015 12:46:15 +0100
changeset 242072 cf071489834b4dc8594f1a4c8a50a28ae034c669
parent 242071 e57f94dd5cf33cd4fd20e4edaee21ab6408924cf
child 242073 d9adce0440820199d0a6b5f41d4995e0796706a6
push id634
push usermozilla@noorenberghe.ca
push dateTue, 10 Feb 2015 22:34:30 +0000
reviewersFlorian
bugs1122493
milestone38.0a1
Bug 1122493 - reset alias to prevent reappear keywords when restoring default search engines. r=Florian
browser/components/preferences/in-content/search.js
browser/components/preferences/search.js
--- a/browser/components/preferences/in-content/search.js
+++ b/browser/components/preferences/in-content/search.js
@@ -338,16 +338,21 @@ EngineStore.prototype = {
     for (var i = 0; i < this._defaultEngines.length; ++i) {
       var e = this._defaultEngines[i];
 
       // If the engine is already in the list, just move it.
       if (this._engines.some(this._isSameEngine, e)) {
         this.moveEngine(this._getEngineByName(e.name), i);
       } else {
         // Otherwise, add it back to our internal store
+
+        // The search service removes the alias when an engine is hidden,
+        // so clear any alias we may have cached before unhiding the engine.
+        e.alias = "";
+
         this._engines.splice(i, 0, e);
         let engine = e.originalEngine;
         engine.hidden = false;
         Services.search.moveEngine(engine, i);
         added++;
       }
     }
     gSearchPane.showRestoreDefaults(false);
--- a/browser/components/preferences/search.js
+++ b/browser/components/preferences/search.js
@@ -367,16 +367,21 @@ EngineStore.prototype = {
     for (var i = 0; i < this._defaultEngines.length; ++i) {
       var e = this._defaultEngines[i];
 
       // If the engine is already in the list, just move it.
       if (this._engines.some(this._isSameEngine, e)) {
         this.moveEngine(this._getEngineByName(e.name), i);
       } else {
         // Otherwise, add it back to our internal store
+
+        // The search service removes the alias when an engine is hidden,
+        // so clear any alias we may have cached before unhiding the engine.
+        e.alias = "";
+
         this._engines.splice(i, 0, e);
         this._ops.push(new EngineUnhideOp(e, i));
         added++;
       }
     }
     gSearchPane.showRestoreDefaults(false);
     gSearchPane.buildDefaultEngineDropDown();
     return added;