Bug 650820 - Adding a search engine without an icon thrown an error [r=mfinkle] DONTBUILD (mobile only)
authorVivien Nicolas <21@vingtetun.org>
Tue, 03 May 2011 20:23:00 +0200
changeset 68907 a2b66f1b996a0c5190fcd8a663f1057f7e27659a
parent 68906 9f3466cf2163b8076cff1c20828fab8e56f6cf44
child 68908 bed84d4108023bbdc17805f78fcc8abdfd9509b6
push id19796
push uservnicolas@mozilla.com
push dateTue, 03 May 2011 18:23:43 +0000
treeherdermozilla-central@a2b66f1b996a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs650820
milestone6.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 650820 - Adding a search engine without an icon thrown an error [r=mfinkle] DONTBUILD (mobile only)
mobile/chrome/content/common-ui.js
mobile/components/AutoCompleteCache.js
mobile/themes/core/browser.css
--- a/mobile/chrome/content/common-ui.js
+++ b/mobile/chrome/content/common-ui.js
@@ -75,17 +75,17 @@ var BrowserSearch = {
       list.removeChild(list.lastChild);
 
     this.engines.forEach(function(aEngine) {
       let button = document.createElement("button");
       button.className = "action-button";
       button.setAttribute("label", aEngine.name);
       button.setAttribute("crop", "end");
       button.setAttribute("pack", "start");
-      button.setAttribute("image", aEngine.iconURI ? aEngine.iconURI.spec : null);
+      button.setAttribute("image", aEngine.iconURI ? aEngine.iconURI.spec : "");
       list.appendChild(button);
     });
 
     popup.hidden = false;
     popup.top = BrowserUI.toolbarH - popup.offset;
     popup.anchorTo(document.getElementById("tool-search"));
 
     document.getElementById("urlbar-icons").setAttribute("open", "true");
--- a/mobile/components/AutoCompleteCache.js
+++ b/mobile/components/AutoCompleteCache.js
@@ -318,17 +318,18 @@ AutoCompleteCache.prototype = {
 
   _addSearchProviders: function(aResult) {
     try {
       aResult.QueryInterface(Ci.nsIAutoCompleteSimpleResult);
       if (this.searchEngines.length > 0) {  
         for (let i = 0; i < this.searchEngines.length; i++) {
           let engine = this.searchEngines[i];
           let url = engine.getSubmission(aResult.searchString).uri.spec;
-          aResult.appendMatch(url, engine.name, engine.iconURI.spec, "search");
+          let iconURI = engine.iconURI;
+          aResult.appendMatch(url, engine.name, iconURI ? iconURI.spec : "", "search");
         }
         aResult.setSearchResult(Ci.nsIAutoCompleteResult.RESULT_SUCCESS);
       }
     } catch(ex) {}
   },
 
   stopSearch: function() {
     // Stop any active queries
--- a/mobile/themes/core/browser.css
+++ b/mobile/themes/core/browser.css
@@ -1178,16 +1178,20 @@ pageaction:not([image]) > hbox >.pageact
   -moz-box-flex: 1; /* Needed for the crop attribute to have an effect */
 }
 
 #search-engines-list > .action-button > .button-box > .button-icon {
   width: 32px;
   height: 32px;
 }
 
+#search-engines-list > .action-button[image=""] > .button-box > .button-icon {
+  list-style-image: url("chrome://browser/skin/images/favicon-default-32.png");
+}
+
 /* Preferences window   ---------------------------------------------------- */
 .setting {
   padding-left: @padding_xnormal@;
   border-bottom: @border_width_tiny@ solid #cacdd5;
 }
 
 /* XXX should be a richlistitem */
 .prefbox {