Bug 1546338 - fix some more instances of Port [Bug 1551320 - In XUL documents replace all callers of createElement with createXULElement]. r=jorgk
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Sun, 19 May 2019 16:26:42 +0300
changeset 32930 6b97e6f65af806a8f1d9b316ceba376a575064d0
parent 32929 af02a4451ba2966d9e98f5a881ef21fc8f535a27
child 32931 9331b129db1c34e1168f809251d478c20b52c35b
push idunknown
push userunknown
push dateunknown
reviewersjorgk
bugs1546338, 1551320
Bug 1546338 - fix some more instances of Port [Bug 1551320 - In XUL documents replace all callers of createElement with createXULElement]. r=jorgk
chat/content/imtooltip.xml
chat/modules/OTRUI.jsm
common/src/Overlays.jsm
mail/base/content/extensions.xml
mail/base/modules/QuickFilterManager.jsm
mail/components/im/content/imconversation.xml
mailnews/base/content/folderWidgets.xml
mailnews/base/search/content/searchWidgets.xml
mailnews/db/gloda/content/glodacomplete.xml
--- a/chat/content/imtooltip.xml
+++ b/chat/content/imtooltip.xml
@@ -288,22 +288,22 @@
                      aContact.getTags().map(t => t.name).join(", "));
 
          let buddies = this.contact.getBuddies();
          if (buddies.length <= 1)
            return true;
 
          let buddiesElt = document.getAnonymousElementByAttribute(this, "anonid",
                                                                   "buddies");
-         let sep = document.createElement("separator");
+         let sep = document.createXULElement("separator");
          sep.setAttribute("class", "groove tooltipSeparator");
          buddiesElt.appendChild(sep);
 
          for (let buddy of buddies) {
-           let buddyElt = document.createElement("buddy");
+           let buddyElt = document.createXULElement("buddy");
            buddiesElt.appendChild(buddyElt);
            buddyElt.getBoundingClientRect(); // force binding attachment
            buddyElt.build(buddy, this);
          }
 
          return true;
        ]]>
        </body>
--- a/chat/modules/OTRUI.jsm
+++ b/chat/modules/OTRUI.jsm
@@ -132,19 +132,19 @@ var OTRUI = {
   },
 
   addBuddyContextMenu(buddyContextMenu, doc) {
     if (!buddyContextMenu || !OTR.libLoaded) {
       return;  // Not the buddy list context menu
     }
     OTRUI.removeBuddyContextMenu(doc);
 
-    let sep = doc.createElement("menuseparator");
+    let sep = doc.createXULElement("menuseparator");
     sep.setAttribute("id", "otrsep");
-    let menuitem = doc.createElement("menuitem");
+    let menuitem = doc.createXULElement("menuitem");
     menuitem.setAttribute("label", _("buddycontextmenu.label"));
     menuitem.setAttribute("id", "otrcont");
     menuitem.addEventListener("command", () => {
       let target = buddyContextMenu.triggerNode;
       if (target.localName == "richlistitem") {
         let contact = target.contact;
         let args = OTRUI.contactWrapper(contact);
         args.wrappedJSObject = args;
@@ -478,26 +478,26 @@ var OTRUI = {
     let title = this.globalDoc.createElement("title");
     title.setAttribute("flex", "1");
     title.setAttribute("crop", "end");
     title.textContent = _(type + ".title");
 
     let close = notification.querySelector("toolbarbutton");
     close.setAttribute("oncommand", "this.parentNode.parentNode.dismiss();");
 
-    let top = this.globalDoc.createElement("hbox");
+    let top = this.globalDoc.createXULElement("hbox");
     top.setAttribute("flex", "1");
     top.setAttribute("align", "center");
     top.classList.add("otr-notification-header");
     top.appendChild(notification.messageImage);
     top.appendChild(title);
     top.appendChild(close);
     notification.insertBefore(top, notification.messageDetails);
 
-    let bottom = this.globalDoc.createElement("hbox");
+    let bottom = this.globalDoc.createXULElement("hbox");
     bottom.setAttribute("flex", "1");
     bottom.setAttribute("oncommand", "this.parentNode._doButtonCommand(event);");
     bottom.classList.add("otr-notification-footer");
 
     notification.querySelectorAll("button").forEach((e) => {
       bottom.appendChild(e);
     });
 
--- a/common/src/Overlays.jsm
+++ b/common/src/Overlays.jsm
@@ -192,17 +192,17 @@ class Overlays {
     // We've resolved all the forward references we can, we can now go ahead and load the scripts
     let deferredLoad = [];
     for (let script of unloadedScripts) {
       deferredLoad.push(...this.loadScript(script));
     }
 
     if (this.document.readyState == "complete") {
       let sheet;
-      let overlayTrigger = this.document.createElement("overlayTrigger");
+      let overlayTrigger = this.document.createXULElement("overlayTrigger");
       overlayTrigger.addEventListener("bindingattached", () => {
         oconsole.debug("XBL binding attached, continuing with load");
         if (sheet) {
           sheet.remove();
         }
         overlayTrigger.remove();
 
         setTimeout(() => {
--- a/mail/base/content/extensions.xml
+++ b/mail/base/content/extensions.xml
@@ -51,17 +51,17 @@
               this._warningBtn.label = gStrings.mailExt.GetStringFromName(
                 "warnLegacyRestartButton"
               );
               this._warningBtn.setAttribute("oncommand", "BrowserUtils.restartApplication()");
               this._warningBtn.hidden = false;
 
               if (undoCommand) {
                 if (!undoButton) {
-                  undoButton = document.createElement("button");
+                  undoButton = document.createXULElement("button");
                   undoButton.className = "button-link undo-btn";
                   undoButton.setAttribute(
                     "label", gStrings.mailExt.GetStringFromName("warnLegacyUndoButton")
                   );
                   // We shouldn't really attach non-anonymous content to anonymous content,
                   // but we can.
                   this._warningContainer.insertBefore(
                     undoButton, this._warningContainer.lastElementChild
--- a/mail/base/modules/QuickFilterManager.jsm
+++ b/mail/base/modules/QuickFilterManager.jsm
@@ -862,17 +862,17 @@ var TagFacetingFilter = {
       let tag = tags[iTag];
 
       if (tag.key in keywordMap) {
         addCount++;
 
         // Keep in mind that the XBL does not get built for dynamically created
         //  elements such as these until they get displayed, which definitely
         //  means not before we append it into the tree.
-        let button = aDocument.createElement("toolbarbutton");
+        let button = aDocument.createXULElement("toolbarbutton");
 
         button.setAttribute("id", "qfb-tag-" + tag.key);
         button.addEventListener("command", commandHandler);
         button.addEventListener("click", rightClickHandler);
         button.setAttribute("type", "checkbox");
         if (keywordMap[tag.key] !== null) {
           button.setAttribute("checked", "true");
           if (!keywordMap[tag.key])
--- a/mail/components/im/content/imconversation.xml
+++ b/mail/components/im/content/imconversation.xml
@@ -1111,24 +1111,24 @@
          var name = aBuddy.name;
          if (!name)
            throw new Error("The empty string isn't a valid nick.");
          if (this.buddies.has(name))
            throw new Error("Adding chat buddy " + name + " twice?!");
 
          this.trackNick(name);
 
-         let image = document.createElement("image");
-         let label = document.createElement("label");
+         let image = document.createXULElement("image");
+         let label = document.createXULElement("label");
          label.setAttribute("value", name);
          label.setAttribute("flex", "1");
          label.setAttribute("crop", "end");
 
          // Fix insertBuddy below if you change the DOM makeup!
-         var item = document.createElement("richlistitem");
+         var item = document.createXULElement("richlistitem");
          item.chatBuddy = aBuddy;
          item.appendChild(image);
          item.appendChild(label);
          this.setBuddyAttributes(item);
 
          var color = this._computeColor(name);
          var style = "color: hsl(" + color + ", 100%, 40%);";
          item.colorStyle = style;
--- a/mailnews/base/content/folderWidgets.xml
+++ b/mailnews/base/content/folderWidgets.xml
@@ -406,17 +406,17 @@
              folder instead.
           */
           let parent = this._parentFolder;
           if (parent && (this.getAttribute("showFileHereLabel") == "true" || !mode)) {
             let showAccountsFileHere = this.getAttribute("showAccountsFileHere");
             if ((!parent.isServer || showAccountsFileHere != "false") &&
                 (!mode || mode == "newFolder" || parent.noSelect ||
                  parent.canFileMessages || showAccountsFileHere == "true")) {
-              var menuitem = document.createElement("menuitem");
+              var menuitem = document.createXULElement("menuitem");
               menuitem._folder = this._parentFolder;
               menuitem.setAttribute("generated", "true");
               if (this.hasAttribute("fileHereLabel")) {
                 menuitem.setAttribute("label", this.getAttribute("fileHereLabel"));
                 menuitem.setAttribute("accesskey", this.getAttribute("fileHereAccessKey"));
               } else {
                 menuitem.setAttribute("label", this._parentFolder.prettyName);
                 menuitem.setAttribute("class", "folderMenuItem menuitem-iconic");
@@ -424,17 +424,17 @@
               }
               // Eww. have to support some legacy code here...
               menuitem.setAttribute("id", this._parentFolder.URI);
               this.appendChild(menuitem);
 
               if (this._parentFolder.noSelect)
                 menuitem.setAttribute("disabled", "true");
 
-              let sep = document.createElement("menuseparator");
+              let sep = document.createXULElement("menuseparator");
               sep.setAttribute("generated", "true");
               this.appendChild(sep);
             }
           }
 
           let globalInboxFolder = null;
           // See if this is the toplevel menu (usually with accounts).
           if (!this._parentFolder) {
@@ -446,17 +446,17 @@
               addSeparator = true;
             }
             if (this.getAttribute("showFavorites") == "true") {
               this._buildSpecialMenu("favorites");
               addSeparator = true;
             }
             if (addSeparator) {
               // If we added Recent and/or Favorites, separate them from the rest of the items.
-              let sep = document.createElement("menuseparator");
+              let sep = document.createXULElement("menuseparator");
               sep.setAttribute("generated", "true");
               this.appendChild(sep);
             }
             // If we are showing the accounts for deferring, move Local Folders to the top.
             if (mode == "deferred") {
               globalInboxFolder = this.MailServices.accounts.localFoldersServer
                                                             .rootFolder;
               let localFoldersIndex = folders.indexOf(globalInboxFolder);
@@ -516,27 +516,27 @@
           for (let folder of folders) {
             let node;
             if (!folder.isServer)
               this._serversOnly = false;
 
             // If we're going to add subFolders, we need to make menus, not
             // menuitems.
             if (!folder.hasSubFolders || !shouldExpand(folder.server.type)) {
-              node = document.createElement("menuitem");
+              node = document.createXULElement("menuitem");
               // Grumble, grumble, legacy code support
               node.setAttribute("id", folder.URI);
               node.setAttribute("class", "folderMenuItem menuitem-iconic");
               node.setAttribute("generated", "true");
               this.appendChild(node);
             } else {
               this._serversOnly = false;
               // xxx this is slightly problematic in that we haven't confirmed
               //     whether any of the subfolders will pass the filter
-              node = document.createElement("menu");
+              node = document.createXULElement("menu");
               node.setAttribute("class", "folderMenuItem menu-iconic");
               node.setAttribute("generated", "true");
               this.appendChild(node);
 
               // Create the submenu
               // (We must use cloneNode here because on OS X the native menu
               // functionality and very sad limitations of XBL1 cause the bindings
               // to never get created for popup if we create a new element.  We
@@ -558,22 +558,22 @@
                 popup.setAttribute("disableServers",
                                    this.getAttribute("disableServers"));
               if (this.hasAttribute("position"))
                 popup.setAttribute("position",
                                    this.getAttribute("position"));
 
               // If there are labels, add the labels now
               if (labels) {
-                var serverNode = document.createElement("menuitem");
+                var serverNode = document.createXULElement("menuitem");
                 serverNode.setAttribute("label", labels[folder.server.type]);
                 serverNode._folder = folder;
                 serverNode.setAttribute("generated", "true");
                 popup.appendChild(serverNode);
-                let sep = document.createElement("menuseparator");
+                let sep = document.createXULElement("menuseparator");
                 sep.setAttribute("generated", "true");
                 popup.appendChild(sep);
               }
 
               popup.setAttribute("generated", "true");
               node.appendChild(popup);
             }
 
@@ -598,28 +598,28 @@
          - This only builds the menu item in the top-level menulist.
          - The real submenu will be created once the popup is really shown,
          - via the _buildSpecialSubmenu method.
          -->
       <method name="_buildSpecialMenu">
         <parameter name="type"/>
         <body><![CDATA[
           // Now create the Recent folder and its children
-          let menu = document.createElement("menu");
+          let menu = document.createXULElement("menu");
           if (type == "recent") {
             menu.setAttribute("label", this.getAttribute("recentLabel"));
             menu.setAttribute("accesskey", this.getAttribute("recentAccessKey"));
           } else {
             menu.setAttribute("label", this.getAttribute("favoritesLabel"));
             menu.setAttribute("accesskey", this.getAttribute("favoritesAccessKey"));
           }
           menu.setAttribute("special", type);
           menu.setAttribute("generated", "true");
 
-          let popup = document.createElement("menupopup");
+          let popup = document.createXULElement("menupopup");
           popup.setAttribute("class", this.getAttribute("class"));
           popup.addEventListener("popupshowing",
                                  () => this._buildSpecialSubmenu(menu),
                                  { once: true });
 
           menu.appendChild(popup);
           this.appendChild(menu);
         ]]></body>
@@ -688,17 +688,17 @@
             folderItem.label = label;
           }
 
           // Make sure the entries are sorted alphabetically.
           specialFoldersMap.sort((a, b) => this.folderNameCompare(a.label, b.label));
 
           // Create entries for each of the recent folders.
           for (let folderItem of specialFoldersMap) {
-            let node = document.createElement("menuitem");
+            let node = document.createXULElement("menuitem");
 
             node.setAttribute("label", folderItem.label);
             node._folder = folderItem.folder;
 
             node.setAttribute("class", "folderMenuItem menuitem-iconic");
             this._setCssSelectors(folderItem.folder, node);
             node.setAttribute("generated", "true");
             menu.menupopup.appendChild(node);
--- a/mailnews/base/search/content/searchWidgets.xml
+++ b/mailnews/base/search/content/searchWidgets.xml
@@ -553,17 +553,17 @@
             this.mListBox.getItemAtIndex(0).mRemoveButton.disabled = this.mListBox.getRowCount() == 1;
           ]]>
         </body>
       </method>
 
       <method name="addRow">
         <body>
           <![CDATA[
-            let listItem = document.createElement("richlistitem");
+            let listItem = document.createXULElement("richlistitem");
             listItem.className = "ruleaction";
             listItem.setAttribute("onfocus", "this.storeFocus();");
             this.mListBox.insertBefore(listItem, this.nextSibling);
             this.mListBox.ensureElementIsVisible(listItem);
 
             // make sure the first remove button is enabled
             this.updateRemoveButton();
             checkActionsReorder();
--- a/mailnews/db/gloda/content/glodacomplete.xml
+++ b/mailnews/db/gloda/content/glodacomplete.xml
@@ -27,17 +27,17 @@
             // trim the leading/trailing whitespace
             var trimmedSearchString = controller.searchString.trim();
 
             let glodaCompleter = Cc["@mozilla.org/autocomplete/search;1?name=gloda"]
                                    .getService(Ci.nsIAutoCompleteSearch)
                                    .wrappedJSObject;
             var result = glodaCompleter.curResult;
 
-            item = document.createElement("richlistitem", { is: result.getStyleAt(this._currentIndex) });
+            item = document.createXULElement("richlistitem", { is: result.getStyleAt(this._currentIndex) });
 
             // set these attributes before we set the class
             // so that we can use them from the constructor
             var row = result.getObjectAt(this._currentIndex);
             item.setAttribute("text", trimmedSearchString);
             item.setAttribute("type", result.getStyleAt(this._currentIndex));
 
             item.row = row;