Bug 1475817 - Part 4: Replace listbox in applicationManager.xul/js. r=darktrojan DONTBUILD
--- 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>