Bug 1475817 - Part 4: Replace listbox in applicationManager.xul/js. r=darktrojan DONTBUILD
authorJorg K <jorgk@jorgk.com>
Tue, 17 Jul 2018 11:48:37 +0200
changeset 31759 4e763866d18285694952a98b7849ed94cffb48c6
parent 31758 d0dc345d7a37adbbd898fe0be07dcad7b5fde6e5
child 31760 4dbba9600c604e9d2c61c22492661e3938081388
push id2308
push userclokep@gmail.com
push dateWed, 05 Sep 2018 00:34:58 +0000
treeherdercomm-beta@e326b2dcd127 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdarktrojan
bugs1475817
Bug 1475817 - Part 4: Replace listbox in applicationManager.xul/js. r=darktrojan DONTBUILD
mail/components/preferences/applicationManager.js
mail/components/preferences/applicationManager.xul
--- a/mail/components/preferences/applicationManager.js
+++ b/mail/components/preferences/applicationManager.js
@@ -21,20 +21,30 @@ var gAppManagerDialog = {
     var list = document.getElementById("appList");
     var apps = this.handlerInfo.possibleApplicationHandlers.enumerate();
     while (apps.hasMoreElements()) {
       let app = apps.getNext();
       if (!gApplicationsPane.isValidHandlerApp(app))
         continue;
 
       app.QueryInterface(Ci.nsIHandlerApp);
-      var item = list.appendItem(app.name);
-      item.setAttribute("image", gApplicationsPane._getIconURLForHandlerApp(app));
-      item.className = "listitem-iconic";
+
+      // Ensure the XBL binding is created eagerly.
+      // eslint-disable-next-line no-undef
+      list.appendChild(MozXULElement.parseXULToFragment("<richlistitem/>"));
+      let item = list.lastChild;
       item.app = app;
+
+      let image = document.createElement("image");
+      image.setAttribute("src", gApplicationsPane._getIconURLForHandlerApp(app));
+      item.appendChild(image);
+
+      let label = document.createElement("label");
+      label.setAttribute("value", app.name);
+      item.appendChild(label);
     }
 
     list.selectedIndex = 0;
   },
 
   onOK: function appManager_onOK() {
     if (!this._removed.length) {
       // return early to avoid calling the |store| method.
--- a/mail/components/preferences/applicationManager.xul
+++ b/mail/components/preferences/applicationManager.xul
@@ -37,17 +37,20 @@
                   src="chrome://messenger/locale/preferences/applicationManager.properties"/>
     <stringbundle id="bundlePreferences"
                   src="chrome://messenger/locale/preferences/preferences.properties"/>
   </stringbundleset>
 
   <description id="appDescription"/>
   <separator class="thin"/>
   <hbox flex="1">
-    <listbox id="appList" onselect="gAppManagerDialog.onSelect();" flex="1"/>
+    <richlistbox id="appList"
+                 onselect="gAppManagerDialog.onSelect();"
+                 flex="1"
+                 style="min-height: 150px;"/>
     <vbox>
       <button id="remove"
               label="&remove.label;"
               accesskey="&remove.accesskey;"
               command="cmd_delete"/>
       <spacer flex="1"/>
     </vbox>
   </hbox>