Bug 1449338 - Make sure default engine is found. a=test-fix
authorDale Harvey <dale@arandomurl.com>
Tue, 24 Apr 2018 11:54:00 +0300
changeset 463500 b77d291d6e6058f3a619fa4d5885e41ab330d7f0
parent 463499 bff1a3825be4946670cd601e7d23c9e21b4270e6
child 463501 5de487d0c93874d55ce3659f57cb68f3a39ba145
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstest-fix
bugs1449338
milestone60.0
Bug 1449338 - Make sure default engine is found. a=test-fix MozReview-Commit-ID: 4YfD8B32gaC
browser/base/content/contentSearchUI.js
--- a/browser/base/content/contentSearchUI.js
+++ b/browser/base/content/contentSearchUI.js
@@ -608,20 +608,22 @@ ContentSearchUIController.prototype = {
     this._updateDefaultEngineHeader();
     this._updateSearchWithHeader();
     document.getElementById("contentSearchSettingsButton").textContent =
       this._strings.searchSettings;
   },
 
   _updateDefaultEngineIcon() {
     let eng = this._engines.find(engine => engine.name === this.defaultEngine.name);
-    // We only show the engines icon for default engines, otherwise show
-    // a default; default engines have an identifier
-    let icon = eng.identifier ? this.defaultEngine.icon : DEFAULT_INPUT_ICON;
-    document.body.style.setProperty("--newtab-search-icon", "url(" + icon + ")");
+    if (eng) {
+      // We only show the engines icon for default engines, otherwise show
+      // a default; default engines have an identifier
+      let icon = eng.identifier ? this.defaultEngine.icon : DEFAULT_INPUT_ICON;
+      document.body.style.setProperty("--newtab-search-icon", "url(" + icon + ")");
+    }
   },
 
   _updateDefaultEngineHeader() {
     let header = document.getElementById("contentSearchDefaultEngineHeader");
     header.firstChild.setAttribute("src", this.defaultEngine.icon);
     if (!this._strings) {
       return;
     }