Bug 590725 - Convert suite/ files for content XUL being killed. (feed part) r+=Neil
authorNeil Rashbrook <neil@httl.net>
Thu, 26 Aug 2010 01:51:44 -0400
changeset 6316 e7918600229dd47f97e62cdaebd80afb9e58517f
parent 6315 87014e0c1dcbfd8bb0f9440d596835cf88310359
child 6317 751fccd282f65ccb8fc9ade555a481232ffcf18a
push idunknown
push userunknown
push dateunknown
bugs590725
Bug 590725 - Convert suite/ files for content XUL being killed. (feed part) r+=Neil r=Callek
suite/common/feeds/subscribe.css
suite/common/feeds/subscribe.xhtml
suite/common/feeds/subscribe.xml
suite/common/jar.mn
suite/feeds/src/FeedWriter.js
suite/themes/classic/communicator/feed-subscribe-ui.css
suite/themes/classic/communicator/feed-subscribe.css
suite/themes/classic/jar.mn
suite/themes/modern/communicator/feed-subscribe-ui.css
suite/themes/modern/communicator/feed-subscribe.css
suite/themes/modern/jar.mn
new file mode 100644
--- /dev/null
+++ b/suite/common/feeds/subscribe.css
@@ -0,0 +1,3 @@
+#feedSubscribeLine {
+  -moz-binding: url(chrome://communicator/content/feeds/subscribe.xml#feedreaderUI);
+}
--- a/suite/common/feeds/subscribe.xhtml
+++ b/suite/common/feeds/subscribe.xhtml
@@ -11,65 +11,41 @@
   <!ENTITY % feedDTD
     SYSTEM "chrome://communicator/locale/feeds/subscribe.dtd">
   %feedDTD;
 ]>
 
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
 
 <html id="feedHandler"
-      xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+      xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <title>&feedPage.title;</title>
     <link rel="stylesheet"
+          href="chrome://communicator/content/feeds/subscribe.css"
+          type="text/css"
+          media="all"/>
+    <link rel="stylesheet"
           href="chrome://communicator/skin/feed-subscribe.css"
           type="text/css"
           media="all"/>
     <script type="application/javascript"
             src="chrome://communicator/content/feeds/subscribe.js"/>
   </head>
   <body onload="SubscribeHandler.writeContent();" onunload="SubscribeHandler.uninit();">
     <div id="feedHeaderContainer">
       <div id="feedHeader" dir="&locale.dir;">
         <div id="feedIntroText">
           <p id="feedSubscriptionInfo1" />
           <p id="feedSubscriptionInfo2" />
         </div>
-
-<!-- XXXmano this can't have any whitespace in it.  Otherwise you would see
-     how much XUL-in-XHTML sucks, see bug 348830 -->
-        <div id="feedSubscribeLine"
-          ><xul:vbox
-            ><xul:hbox align="center"
-              ><xul:description id="subscribeUsingDescription"
-              /><xul:menulist id="handlersMenuList" aria-labelledby="subscribeUsingDescription"
-                ><xul:menupopup menugenerated="true" id="handlersMenuPopup"
-                  ><xul:menuitem id="messengerFeedsMenuItem" label="&feedMessenger;" class="menuitem-iconic" image="chrome://communicator/skin/icons/feedIcon16.png" selected="true"
-                  /><xul:menuitem id="liveBookmarksMenuItem" label="&feedLiveBookmarks;" class="menuitem-iconic" image="chrome://communicator/skin/icons/feedIcon16.png" selected="true"
-                  /><xul:menuseparator
-                /></xul:menupopup
-              ></xul:menulist
-            ></xul:hbox
-            ><xul:hbox
-              ><xul:checkbox id="alwaysUse" checked="false"
-            /></xul:hbox
-            ><xul:hbox align="center"
-              ><xul:spacer flex="1"
-              /><xul:button label="&feedSubscribeNow;" id="subscribeButton"
-            /></xul:hbox
-          ></xul:vbox
-        ></div
-      ></div>
+        <div id="feedSubscribeLine" />
+      </div>
     </div>
 
-    <script type="application/javascript">
-      SubscribeHandler.init();
-    </script>
-
     <div id="feedBody">
       <div id="feedTitle">
         <a id="feedTitleLink">
           <img id="feedTitleImage"/>
         </a>
         <div id="feedTitleContainer">
           <h1 id="feedTitleText"/>
           <h2 id="feedSubtitleText"/>
new file mode 100644
--- /dev/null
+++ b/suite/common/feeds/subscribe.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<!DOCTYPE bindings SYSTEM "chrome://communicator/locale/feeds/subscribe.dtd">
+
+<bindings id="feedBindings"
+          xmlns="http://www.mozilla.org/xbl"
+          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+  <binding id="feedreaderUI">
+    <content>
+      <xul:vbox>
+        <xul:hbox align="center">
+          <xul:description anonid="subscribeUsingDescription" class="subscribeUsingDescription"/>
+          <xul:menulist anonid="handlersMenuList" class="handlersMenuList" aria-labelledby="subscribeUsingDescription">
+            <xul:menupopup menugenerated="true" anonid="handlersMenuPopup" class="handlersMenuPopup">
+              <xul:menuitem anonid="messengerFeedsMenuItem" label="&feedMessenger;" class="menuitem-iconic messengerFeedsMenuItem" image="chrome://communicator/skin/icons/feedIcon16.png" selected="true"/>
+              <xul:menuitem anonid="liveBookmarksMenuItem" label="&feedLiveBookmarks;" class="menuitem-iconic liveBookmarksMenuItem" image="chrome://communicator/skin/icons/feedIcon16.png"/>
+              <xul:menuseparator/>
+            </xul:menupopup>
+          </xul:menulist>
+        </xul:hbox>
+        <xul:hbox>
+          <xul:checkbox anonid="alwaysUse" class="alwaysUse" checked="false"/>
+        </xul:hbox>
+        <xul:hbox align="center">
+          <xul:spacer flex="1"/>
+          <xul:button label="&feedSubscribeNow;" anonid="subscribeButton" class="subscribeButton"/>
+        </xul:hbox>
+      </xul:vbox>
+    </content>
+    <implementation>
+      <constructor>
+        SubscribeHandler.init();
+      </constructor>
+    </implementation>
+    <resources>
+      <stylesheet src="chrome://communicator/skin/feed-subscribe-ui.css"/>
+    </resources>
+  </binding>
+</bindings>
--- a/suite/common/jar.mn
+++ b/suite/common/jar.mn
@@ -134,18 +134,20 @@ comm.jar:
    content/communicator/downloads/downloadmanager.js                (downloads/downloadmanager.js)
    content/communicator/downloads/downloadmanager.xul               (downloads/downloadmanager.xul)
    content/communicator/downloads/DownloadProgressListener.js       (downloads/DownloadProgressListener.js)
    content/communicator/downloads/progressDialog.xul                (downloads/progressDialog.xul)
    content/communicator/downloads/progressDialog.js                 (downloads/progressDialog.js)
    content/communicator/downloads/uploadProgress.xul                (downloads/uploadProgress.xul)
    content/communicator/downloads/uploadProgress.js                 (downloads/uploadProgress.js)
    content/communicator/downloads/treeView.js                       (downloads/treeView.js)
+   content/communicator/feeds/subscribe.css                         (feeds/subscribe.css)
+   content/communicator/feeds/subscribe.js                          (feeds/subscribe.js)
    content/communicator/feeds/subscribe.xhtml                       (feeds/subscribe.xhtml)
-   content/communicator/feeds/subscribe.js                          (feeds/subscribe.js)
+   content/communicator/feeds/subscribe.xml                         (feeds/subscribe.xml)
    content/communicator/history/controller.js                       (history/controller.js)
    content/communicator/history/history.js                          (history/history.js)
    content/communicator/history/history.xul                         (history/history.xul)
    content/communicator/history/history-panel.xul                   (history/history-panel.xul)
    content/communicator/history/places.css                          (history/places.css)
    content/communicator/history/placesOverlay.xul                   (history/placesOverlay.xul)
    content/communicator/history/sidebarUtils.js                     (history/sidebarUtils.js)
    content/communicator/history/tree.xml                            (history/tree.xml)
--- a/suite/feeds/src/FeedWriter.js
+++ b/suite/feeds/src/FeedWriter.js
@@ -721,16 +721,25 @@ FeedWriter.prototype = {
     this._contentSandbox.label = this._getFileDisplayName(aFile);
     this._contentSandbox.image = this._getFileIconURL(aFile);
     var codeStr = "menuitem.setAttribute('label', label); " +
                   "menuitem.setAttribute('image', image);";
     Components.utils.evalInSandbox(codeStr, this._contentSandbox);
   },
 
   /**
+   * Helper method to get an element in the XBL binding where the handler
+   * selection UI lives
+   */
+  _getUIElement: function getUIElement(id) {
+    return this._document.getAnonymousElementByAttribute(
+      this._document.getElementById("feedSubscribeLine"), "anonid", id);
+  },
+
+  /**
    * Displays a prompt from which the user may choose a (client) feed reader.
    * @return - true if a feed reader was selected, false otherwise.
    */
   _chooseClientApp: function chooseClientApp() {
     try {
       var fp = Components.classes["@mozilla.org/filepicker;1"]
                          .createInstance(Components.interfaces.nsIFilePicker);
       fp.init(this._window,
@@ -767,17 +776,17 @@ FeedWriter.prototype = {
     }
     catch(ex) {
     }
 
     return false;
   },
 
   _setAlwaysUseCheckedState: function setAlwaysUseCheckedState(feedType) {
-    var checkbox = this._document.getElementById("alwaysUse");
+    var checkbox = this._getUIElement("alwaysUse");
     if (checkbox) {
       var alwaysUse = (safeGetCharPref(getPrefActionForType(feedType), "ask") != "ask");
       this._setCheckboxCheckedState(checkbox, alwaysUse);
     }
   },
 
   _setSubscribeUsingLabel: function setSubscribeUsingLabel() {
     var stringLabel = "subscribeFeedUsing";
@@ -787,28 +796,27 @@ FeedWriter.prototype = {
         break;
 
       case Components.interfaces.nsIFeed.TYPE_AUDIO:
         stringLabel = "subscribeAudioPodcastUsing";
         break;
     }
 
     this._contentSandbox.subscribeUsing =
-      this._document.getElementById("subscribeUsingDescription");
+      this._getUIElement("subscribeUsingDescription");
     this._contentSandbox.label = this._getString(stringLabel);
     var codeStr = "subscribeUsing.setAttribute('value', label);"
     Components.utils.evalInSandbox(codeStr, this._contentSandbox);
   },
 
   _setAlwaysUseLabel: function setAlwaysUseLabel() {
-    var checkbox = this._document.getElementById("alwaysUse");
+    var checkbox = this._getUIElement("alwaysUse");
     if (checkbox) {
-      var handlersMenuList = this._document.getElementById("handlersMenuList");
-      if (handlersMenuList) {
-        var handlerName = this._getSelectedItemFromMenulist(handlersMenuList)
+      if (this._handlersMenuList) {
+        var handlerName = this._getSelectedItemFromMenulist(this._handlersMenuList)
                               .getAttribute("label");
         var stringLabel = "alwaysUseForFeeds";
         switch (this._getFeedType()) {
           case Components.interfaces.nsIFeed.TYPE_VIDEO:
             stringLabel = "alwaysUseForVideoPodcasts";
             break;
 
           case Components.interfaces.nsIFeed.TYPE_AUDIO:
@@ -830,31 +838,30 @@ FeedWriter.prototype = {
     // see comments in init()
     event = new XPCNativeWrapper(event);
     if (event.target.ownerDocument != this._document) {
       LOG("FeedWriter.handleEvent: Someone passed the feed writer as a listener to the events of another document!");
       return;
     }
 
     if (event.type == "command") {
-      switch (event.target.id) {
+      switch (event.target.getAttribute("anonid")) {
         case "subscribeButton":
           this.subscribe();
           break;
         case "chooseApplicationMenuItem":
           /* Bug 351263: Make sure to not steal focus if the "Choose
            * Application" item is being selected with the keyboard. We do this
            * by ignoring command events while the dropdown is closed (user
            * arrowing through the combobox), but handling them while the
            * combobox dropdown is open (user pressed enter when an item was
            * selected). If we don't show the filepicker here, it will be shown
            * when clicking "Subscribe Now".
            */
-          var popupbox = this._document.getElementById("handlersMenuList")
-                             .firstChild.boxObject;
+          var popupbox = this._handlersMenuList.firstChild.boxObject;
           popupbox.QueryInterface(Components.interfaces.nsIPopupBoxObject);
           if (popupbox.popupState == "hiding" && !this._chooseClientApp()) {
             // Select the (per-prefs) selected handler if no application was
             // selected
             this._setSelectedHandler(this._getFeedType());
           }
           break;
         default:
@@ -865,21 +872,20 @@ FeedWriter.prototype = {
 
   _setSelectedHandler: function setSelectedHandler(feedType) {
     var prefs = Components.classes["@mozilla.org/preferences-service;1"]
                           .getService(Components.interfaces.nsIPrefBranch);
     var handler = safeGetCharPref(getPrefReaderForType(feedType), "messenger");
 
     switch (handler) {
       case "web":
-        var handlersMenuList = this._document.getElementById("handlersMenuList");
-        if (handlersMenuList) {
+        if (this._handlersMenuList) {
           var url = prefs.getComplexValue(getPrefWebForType(feedType),
                                           Components.interfaces.nsISupportsString).data;
-          var handlers = handlersMenuList.getElementsByAttribute("webhandlerurl", url);
+          var handlers = this._handlersMenuList.getElementsByAttribute("webhandlerurl", url);
           if (handlers.length == 0) {
             LOG("FeedWriter._setSelectedHandler: selected web handler isn't in the menulist");
             return;
           }
 
           this._safeDoCommand(handlers[0]);
         }
         break;
@@ -904,31 +910,31 @@ FeedWriter.prototype = {
           if (this._defaultSystemReader) {
             var shouldHide = this._defaultSystemReader.path == this._selectedApp.path;
             codeStr += "defaultHandlerMenuItem.hidden = " + shouldHide + ";";
           }
           Components.utils.evalInSandbox(codeStr, this._contentSandbox);
           break;
         }
        case "bookmarks":
-         var liveBookmarksMenuItem = this._document.getElementById("liveBookmarksMenuItem");
+         var liveBookmarksMenuItem = this._getUIElement("liveBookmarksMenuItem");
          if (liveBookmarksMenuItem)
            this._safeDoCommand(liveBookmarksMenuItem);
          break;
       // fall through if this._selectedApp is null
       default:
-        var messengerFeedsMenuItem = this._document.getElementById("messengerFeedsMenuItem");
+        var messengerFeedsMenuItem = this._getUIElement("messengerFeedsMenuItem");
         if (messengerFeedsMenuItem)
           this._safeDoCommand(messengerFeedsMenuItem);
         break;
     }
   },
 
   _initSubscriptionUI: function initSubscriptionUI() {
-    var handlersMenuPopup = this._document.getElementById("handlersMenuPopup");
+    var handlersMenuPopup = this._getUIElement("handlersMenuPopup");
     if (!handlersMenuPopup)
       return;
 
     var feedType = this._getFeedType();
     var codeStr;
 
     // change the background
     var header = this._document.getElementById("feedHeader");
@@ -941,21 +947,23 @@ FeedWriter.prototype = {
       case Components.interfaces.nsIFeed.TYPE_AUDIO:
         codeStr = "header.className = 'audioPodcastBackground'; ";
         break;
 
       default:
         codeStr = "header.className = 'feedBackground'; ";
     }
 
+    var liveBookmarksMenuItem = this._getUIElement("liveBookmarksMenuItem");
 
     // Last-selected application
-    var menuItem = this._document.createElementNS(XUL_NS, "menuitem");
-    menuItem.id = "selectedAppMenuItem";
-    menuItem.className = "menuitem-iconic";
+    var menuItem = liveBookmarksMenuItem.cloneNode(false);
+    menuItem.removeAttribute("selected");
+    menuItem.setAttribute("anonid", "selectedAppMenuItem");
+    menuItem.className = "menuitem-iconic selectedAppMenuItem";
     menuItem.setAttribute("handlerType", "client");
     try {
       var prefs = Components.classes["@mozilla.org/preferences-service;1"]
                             .getService(Components.interfaces.nsIPrefBranch);
       this._selectedApp = prefs.getComplexValue(getPrefAppForType(feedType),
                                                 Components.interfaces.nsILocalFile);
 
       if (this._selectedApp.exists())
@@ -976,19 +984,20 @@ FeedWriter.prototype = {
 
     menuItem = null;
 
     // List the default feed reader
     try {
       this._defaultSystemReader = Components.classes["@mozilla.org/suite/shell-feed-service;1"]
                                             .getService(Components.interfaces.nsIShellService)
                                             .defaultFeedReader;
-      menuItem = this._document.createElementNS(XUL_NS, "menuitem");
-      menuItem.id = "defaultHandlerMenuItem";
-      menuItem.className = "menuitem-iconic";
+      menuItem = liveBookmarksMenuItem.cloneNode(false);
+      menuItem.removeAttribute("selected");
+      menuItem.setAttribute("anonid", "defaultHandlerMenuItem");
+      menuItem.className = "menuitem-iconic defaultHandlerMenuItem";
       menuItem.setAttribute("handlerType", "client");
 
       this._initMenuItemWithFile(menuItem, this._defaultSystemReader);
 
       // Hide the default reader item if it points to the same application
       // as the last-selected application
       if (this._selectedApp &&
           this._selectedApp.path == this._defaultSystemReader.path)
@@ -998,41 +1007,44 @@ FeedWriter.prototype = {
     }
 
     if (menuItem) {
       this._contentSandbox.defaultHandlerMenuItem = menuItem;
       codeStr += "handlersMenuPopup.appendChild(defaultHandlerMenuItem); ";
     }
 
     // "Choose Application..." menuitem
-    menuItem = this._document.createElementNS(XUL_NS, "menuitem");
-    menuItem.id = "chooseApplicationMenuItem";
+    menuItem = liveBookmarksMenuItem.cloneNode(false);
+    menuItem.removeAttribute("selected");
+    menuItem.setAttribute("anonid", "chooseApplicationMenuItem");
+    menuItem.className = "menuitem-iconic chooseApplicationMenuItem";
     menuItem.setAttribute("label", this._getString("chooseApplicationMenuItem"));
 
     this._contentSandbox.chooseAppMenuItem = menuItem;
     codeStr += "handlersMenuPopup.appendChild(chooseAppMenuItem); ";
 
     // separator
-    this._contentSandbox.chooseAppSep = this._document
-                                            .createElementNS(XUL_NS, "menuseparator");
+    this._contentSandbox.chooseAppSep =
+      menuItem = liveBookmarksMenuItem.nextSibling.cloneNode(false);
     codeStr += "handlersMenuPopup.appendChild(chooseAppSep); ";
 
     Components.utils.evalInSandbox(codeStr, this._contentSandbox);
 
     var historySvc = Components.classes["@mozilla.org/browser/nav-history-service;1"]
                                .getService(Components.interfaces.nsINavHistoryService);
     historySvc.addObserver(this, false);
 
     // List of web handlers
     var wccr = Components.classes["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"]
                          .getService(Components.interfaces.nsIWebContentConverterService);
     var handlers = wccr.getContentHandlers(this._getMimeTypeForFeedType(feedType));
     if (handlers.length != 0) {
       for (let i = 0; i < handlers.length; ++i) {
-        menuItem = this._document.createElementNS(XUL_NS, "menuitem");
+        menuItem = liveBookmarksMenuItem.cloneNode(false);
+        menuItem.removeAttribute("selected");
         menuItem.className = "menuitem-iconic";
         menuItem.setAttribute("label", handlers[i].name);
         menuItem.setAttribute("handlerType", "web");
         menuItem.setAttribute("webhandlerurl", handlers[i].uri);
         this._contentSandbox.menuItem = menuItem;
         codeStr = "handlersMenuPopup.appendChild(menuItem);";
         Components.utils.evalInSandbox(codeStr, this._contentSandbox);
 
@@ -1056,18 +1068,17 @@ FeedWriter.prototype = {
     this._setAlwaysUseCheckedState(feedType);
     this._setAlwaysUseLabel();
 
     // We update the "Always use.." checkbox label whenever the selected item
     // in the list is changed
     handlersMenuPopup.addEventListener("command", this, false);
 
     // Set up the "Subscribe Now" button
-    this._document
-        .getElementById("subscribeButton")
+    this._getUIElement("subscribeButton")
         .addEventListener("command", this, false);
 
     // first-run ui
     var showFirstRunUI = true;
     try {
       showFirstRunUI = prefs.getBoolPref(PREF_SHOW_FIRST_RUN_UI);
     }
     catch (ex) {
@@ -1125,29 +1136,31 @@ FeedWriter.prototype = {
 
     return null;
   },
 
   _window: null,
   _document: null,
   _feedURI: null,
   _feedPrincipal: null,
+  _handlersMenuList: null,
 
   // nsIFeedWriter
   init: function init(aWindow) {
     // Explicitly wrap |window| in an XPCNativeWrapper to make sure
     // it's a real native object! This will throw an exception if we
     // get a non-native object.
     var window = new XPCNativeWrapper(aWindow);
     this._feedURI = this._getOriginalURI(window);
     if (!this._feedURI)
       return;
 
     this._window = window;
     this._document = window.document;
+    this._handlersMenuList = this._getUIElement("handlersMenuList");
 
     var secman = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
                            .getService(Components.interfaces.nsIScriptSecurityManager);
     this._feedPrincipal = secman.getCodebasePrincipal(this._feedURI);
 
     LOG("Subscribe Preview: feed uri = " + this._window.location.href);
 
     // Set up the subscription UI
@@ -1184,21 +1197,19 @@ FeedWriter.prototype = {
       this._writeFeedContent(container);
     }
     finally {
       this._removeFeedFromCache();
     }
   },
 
   close: function close() {
-    this._document
-        .getElementById("handlersMenuPopup")
+    this._getUIElement("handlersMenuPopup")
         .removeEventListener("command", this, false);
-    this._document
-        .getElementById("subscribeButton")
+    this._getUIElement("subscribeButton")
         .removeEventListener("command", this, false);
     this._document = null;
     this._window = null;
     var prefs = Components.classes["@mozilla.org/preferences-service;1"]
                           .getService(Components.interfaces.nsIPrefBranch2);
     prefs.removeObserver(PREF_SELECTED_ACTION, this);
     prefs.removeObserver(PREF_SELECTED_READER, this);
     prefs.removeObserver(PREF_SELECTED_WEB, this);
@@ -1235,29 +1246,27 @@ FeedWriter.prototype = {
 
   subscribe: function subscribe() {
     var feedType = this._getFeedType();
 
     // Subscribe to the feed using the selected handler and save prefs
     var prefs = Components.classes["@mozilla.org/preferences-service;1"]
                           .getService(Components.interfaces.nsIPrefBranch);
     var defaultHandler = "reader";
-    var useAsDefault = this._document.getElementById("alwaysUse")
-                                     .getAttribute("checked");
+    var useAsDefault = this._getUIElement("alwaysUse").getAttribute("checked");
 
-    var handlersMenuList = this._document.getElementById("handlersMenuList");
-    var selectedItem = this._getSelectedItemFromMenulist(handlersMenuList);
+    var selectedItem = this._getSelectedItemFromMenulist(this._handlersMenuList);
 
     // Show the file picker before subscribing if the
     // choose application menuitem was chosen using the keyboard
-    if (selectedItem.id == "chooseApplicationMenuItem") {
+    if (selectedItem.getAttribute("anonid") == "chooseApplicationMenuItem") {
       if (!this._chooseClientApp())
         return;
 
-      selectedItem = this._getSelectedItemFromMenulist(handlersMenuList);
+      selectedItem = this._getSelectedItemFromMenulist(this._handlersMenuList);
     }
 
     if (selectedItem.hasAttribute("webhandlerurl")) {
       var webURI = selectedItem.getAttribute("webhandlerurl");
       prefs.setCharPref(getPrefReaderForType(feedType), "web");
 
       var supportsString = Components.classes["@mozilla.org/supports-string;1"]
                                      .createInstance(Components.interfaces.nsISupportsString);
@@ -1272,17 +1281,17 @@ FeedWriter.prototype = {
         if (useAsDefault)
           wccr.setAutoHandler(this._getMimeTypeForFeedType(feedType), handler);
 
         this._window.location.href = handler.getHandlerURI(this._window.location.href);
         return;
       }
     }
     else {
-      switch (selectedItem.id) {
+      switch (selectedItem.getAttribute("anonid")) {
         case "selectedAppMenuItem":
           prefs.setComplexValue(getPrefAppForType(feedType), Components.interfaces.nsILocalFile,
                                 this._selectedApp);
           prefs.setCharPref(getPrefReaderForType(feedType), "client");
           break;
         case "defaultHandlerMenuItem":
           prefs.setComplexValue(getPrefAppForType(feedType), Components.interfaces.nsILocalFile,
                                 this._defaultSystemReader);
@@ -1389,18 +1398,17 @@ FeedWriter.prototype = {
    onPageChanged: function onPageChanged(aURI, aWhat, aValue) {
      // see init()
      aURI = new XPCNativeWrapper(aURI);
 
      if (aWhat == Components.interfaces.nsINavHistoryObserver.ATTRIBUTE_FAVICON) {
        // Go through the readers menu and look for the corresponding
        // reader menu-item for the page if any.
        var spec = aURI.spec;
-       var handlersMenulist = this._document.getElementById("handlersMenuList");
-       var possibleHandlers = handlersMenulist.firstChild.childNodes;
+       var possibleHandlers = this._handlersMenuList.firstChild.childNodes;
        for (let i=0; i < possibleHandlers.length ; i++) {
          if (possibleHandlers[i].getAttribute("webhandlerurl") == spec) {
            this._setFaviconForWebReader(aURI, possibleHandlers[i]);
            return;
          }
        }
      }
    },
new file mode 100644
--- /dev/null
+++ b/suite/themes/classic/communicator/feed-subscribe-ui.css
@@ -0,0 +1,16 @@
+#feedSubscribeLine {
+  font: message-box;
+}
+
+.menuitem-iconic {
+  -moz-padding-start: 2px;
+}
+
+.menu-iconic-left {
+  display: -moz-box;
+  -moz-padding-end: 2px;
+}
+
+menupopup:-moz-locale-dir(rtl) {
+  direction: rtl;
+}
--- a/suite/themes/classic/communicator/feed-subscribe.css
+++ b/suite/themes/classic/communicator/feed-subscribe.css
@@ -43,40 +43,30 @@ html {
 #feedHeader[dir="rtl"] {
   background-position: 100% 10%;
 }
 
 #feedIntroText {
   display: none;
 }
 
-
-
 #feedHeader[firstrun="true"] #feedIntroText {
   padding-top: 0.1em;
   -moz-padding-start: 0.6em;
   display: block;
 }
 
 #feedHeader[firstrun="true"] > #feedSubscribeLine {
   -moz-padding-start: 1.8em;
 }
 
 #feedSubscribeLine {
   padding-top: 0.2em;
 }
 
-#messengerFeedsMenuItem {
-  list-style-image: url("chrome://communicator/skin/icons/feedIcon16.png");
-}
-
-#feedHeader[dir="rtl"] #handlersMenuList > menupopup {
-  direction: rtl;
-}
-
 /* Don't print subscription UI */
 @media print {
   #feedHeaderContainer {
     display: none;
   }
 }
 
 body {
--- a/suite/themes/classic/jar.mn
+++ b/suite/themes/classic/jar.mn
@@ -70,16 +70,17 @@ classic.jar:
   skin/classic/communicator/bookmarks/toolbarDropMarker.png             (communicator/bookmarks/toolbarDropMarker.png)
   skin/classic/communicator/bookmarks/unsortedBookmarks.png             (communicator/bookmarks/unsortedBookmarks.png)
   skin/classic/communicator/brand/throbber-anim.png                     (communicator/brand/throbber-anim.png)
   skin/classic/communicator/brand/throbber-single.png                   (communicator/brand/throbber-single.png)
   skin/classic/communicator/brand/throbber16-anim.png                   (communicator/brand/throbber16-anim.png)
   skin/classic/communicator/brand/throbber16-single.png                 (communicator/brand/throbber16-single.png)
   skin/classic/communicator/directory/directory.css                     (communicator/directory/directory.css)
   skin/classic/communicator/feed-subscribe.css                          (communicator/feed-subscribe.css)
+  skin/classic/communicator/feed-subscribe-ui.css                       (communicator/feed-subscribe-ui.css)
   skin/classic/communicator/fullscreen-video.css                        (communicator/fullscreen-video.css)
   skin/classic/communicator/directory/folder-clsd.gif                   (communicator/directory/folder-clsd.gif)
   skin/classic/communicator/directory/folder-open.gif                   (communicator/directory/folder-open.gif)
   skin/classic/communicator/directory/file.gif                          (communicator/directory/file.gif)
   skin/classic/communicator/downloads/dl-remove.png                     (communicator/downloads/dl-remove.png)
   skin/classic/communicator/history/calendar.png                        (communicator/history/calendar.png)
   skin/classic/communicator/profile/migrate.gif                         (communicator/profile/migrate.gif)
   skin/classic/communicator/profile/profile.css                         (communicator/profile/profile.css)
new file mode 100644
--- /dev/null
+++ b/suite/themes/modern/communicator/feed-subscribe-ui.css
@@ -0,0 +1,7 @@
+#feedSubscribeLine {
+  font: message-box;
+}
+
+menupopup:-moz-locale-dir(rtl) {
+  direction: rtl;
+}
--- a/suite/themes/modern/communicator/feed-subscribe.css
+++ b/suite/themes/modern/communicator/feed-subscribe.css
@@ -95,24 +95,16 @@ html {
 #feedHeader[firstrun="true"] > #feedSubscribeLine {
   -moz-padding-start: 1.8em;
 }
 
 #feedSubscribeLine {
   padding-top: 0.2em;
 }
 
-#messengerFeedsMenuItem {
-  list-style-image: url("chrome://communicator/skin/icons/feedIcon16.png");
-}
-
-#feedHeader[dir="rtl"] #handlersMenuList > menupopup {
-  direction: rtl;
-}
-
 /* Don't print subscription UI */
 @media print {
   #feedHeaderContainer {
     display: none;
   }
 }
 
 body {
--- a/suite/themes/modern/jar.mn
+++ b/suite/themes/modern/jar.mn
@@ -50,16 +50,17 @@ modern.jar:
   skin/modern/communicator/directory/file-folder-closed.gif        (communicator/directory/file-folder-closed.gif)
   skin/modern/communicator/directory/file-folder-open.gif          (communicator/directory/file-folder-open.gif)
   skin/modern/communicator/directory/file-icon.gif                 (communicator/directory/file-icon.gif)
   skin/modern/communicator/directory/directory.css                 (communicator/directory/directory.css)
   skin/modern/communicator/downloads/dl-remove.png                 (communicator/downloads/dl-remove.png)
   skin/modern/communicator/downloads/downloadButtons.png           (communicator/downloads/downloadButtons.png)
   skin/modern/communicator/downloads/downloadmanager.css           (communicator/downloads/downloadmanager.css)
   skin/modern/communicator/feed-subscribe.css                      (communicator/feed-subscribe.css)
+  skin/modern/communicator/feed-subscribe-ui.css                   (communicator/feed-subscribe-ui.css)
   skin/modern/communicator/fullscreen-video.css                    (communicator/fullscreen-video.css)
   skin/modern/communicator/history/calendar.png                    (communicator/history/calendar.png)
   skin/modern/communicator/icons/alwaysAsk.png                     (communicator/icons/alwaysAsk.png)
   skin/modern/communicator/icons/application.png                   (communicator/icons/application.png)
   skin/modern/communicator/icons/audioFeedIcon.png                 (communicator/icons/feedIcon.png)
   skin/modern/communicator/icons/closeFullScreenVideo.png          (communicator/icons/closeFullScreenVideo.png)
   skin/modern/communicator/icons/btn1.gif                          (communicator/icons/btn1.gif)
   skin/modern/communicator/icons/common.png                        (communicator/icons/common.png)