Bug 1502997 - Do not use GetElementById() to find anonymous elements after bug 1502875. r=jorgk DONTBUILD
authoraceman <acelists@atlas.sk>
Mon, 29 Oct 2018 18:44:00 +0100
changeset 33621 fd1f4b9f6638f3f9c81a65ad651ac536187e5a7b
parent 33620 251d4aa464d29dc07d749dcd9aeb971fc8596201
child 33622 550ea359e239e322cef978fbb3dfd4e6fc5eec09
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersjorgk
bugs1502997, 1502875
Bug 1502997 - Do not use GetElementById() to find anonymous elements after bug 1502875. r=jorgk DONTBUILD
calendar/test/mozmill/shared-modules/test-calendar-utils.js
chat/content/imtooltip.xml
mail/components/preferences/aboutPreferences.xml
mail/components/preferences/subdialogs.js
mail/test/mozmill/pref-window/test-font-chooser.js
mail/themes/shared/mail/incontentprefs/aboutPreferences.css
--- a/calendar/test/mozmill/shared-modules/test-calendar-utils.js
+++ b/calendar/test/mozmill/shared-modules/test-calendar-utils.js
@@ -612,17 +612,17 @@ function findEventsInNode(node, eventNod
         }
     }
 }
 
 function openLightningPrefs(aCallback, aParentController) {
     // Since the Lightning pane is added after load, asking for it with open_pref_tab won't work.
     // Cheat instead.
     let tab = open_pref_tab("paneGeneral");
-    tab.browser.contentDocument.querySelector('#category-box radio[pane="paneLightning"]').click();
+    tab.browser.contentDocument.querySelector('#pref-category-box radio[pane="paneLightning"]').click();
     utils.waitFor(
         () => tab.browser.contentDocument.documentElement.currentPane.id == "paneLightning",
         "Timed out waiting for prefpane paneLightning to load."
     );
     aCallback(tab);
 }
 
 /**
--- a/chat/content/imtooltip.xml
+++ b/chat/content/imtooltip.xml
@@ -417,17 +417,18 @@
            return false;
 
          let elt = document.tooltipNode;
          // No tooltip for elements that have already been removed.
          if (!elt.parentNode)
            return false;
 
          // Reset tooltip.
-         let largeTooltip = document.getElementById("largeTooltip");
+         let largeTooltip = document.getAnonymousElementByAttribute(this, "id",
+                                                                    "largeTooltip");
          largeTooltip.hidden = false;
          this.removeAttribute("label");
 
          let localName = elt.localName;
 
 #ifdef MOZ_THUNDERBIRD
          if (localName == "imconv" && elt.conv)
            return updateTooltipFromConversation(elt.conv);
--- a/mail/components/preferences/aboutPreferences.xml
+++ b/mail/components/preferences/aboutPreferences.xml
@@ -19,17 +19,17 @@
   <binding id="preftab"
            extends="chrome://messenger/content/preferences/preferences.xml#prefwindow">
     <content dlgbuttons="accept,cancel" persist="lastSelected"
              closebuttonlabel="&preferencesCloseButton.label;"
              closebuttonaccesskey="&preferencesCloseButton.accesskey;"
              role="dialog">
       <xul:stack flex="1">
         <xul:hbox id="prefBox" flex="1">
-          <xul:vbox id="category-box">
+          <xul:vbox id="pref-category-box">
             <xul:radiogroup anonid="selector" orient="vertical" class="paneSelector chromeclass-toolbar"
                             role="listbox"/> <!-- Expose to accessibility APIs as a listbox -->
             <xul:spacer flex="1"/>
             <xul:hbox class="sidebar-footer-button"
                       pack="center"
                       onclick="window.docShell.rootTreeItem.domWindow.openAddonsMgr();">
             <xul:label id="addonsButton" class="text-link">
               <xul:hbox align="center">
--- a/mail/components/preferences/subdialogs.js
+++ b/mail/components/preferences/subdialogs.js
@@ -518,18 +518,20 @@ var gSubDialog = {
   _dialogTemplate: null,
   _nextDialogID: 0,
   _preloadDialog: null,
   get _topDialog() {
     return this._dialogs.length > 0 ? this._dialogs[this._dialogs.length - 1] : undefined;
   },
 
   init() {
-    this._dialogStack = document.getElementById("dialogStack");
-    this._dialogTemplate = document.getElementById("dialogTemplate");
+    this._dialogStack = document.getAnonymousElementByAttribute(
+      top.document.documentElement, "id", "dialogStack");
+    this._dialogTemplate = document.getAnonymousElementByAttribute(
+      top.document.documentElement, "id", "dialogTemplate");
     this._preloadDialog = new SubDialog({template: this._dialogTemplate,
                                          parentElement: this._dialogStack,
                                          id: this._nextDialogID++});
   },
 
   open(aURL, aFeatures = null, aParams = null, aClosingCallback = null) {
     // If we're already open/opening on this URL, do nothing.
     if (this._topDialog && this._topDialog._openedURL == aURL) {
--- a/mail/test/mozmill/pref-window/test-font-chooser.js
+++ b/mail/test/mozmill/pref-window/test-font-chooser.js
@@ -92,17 +92,21 @@ function _verify_fonts_displayed(aDefaul
   let displayPaneActual = content_tab_e(prefTab, "defaultFont");
   mc.waitFor(() => displayPaneActual.itemCount > 0,
                 "No font names were populated in the font picker.");
   assert_fonts_equal("display pane", displayPaneExpected, displayPaneActual.value);
 
   // Now open the advanced dialog.
   mc.click(content_tab_eid(prefTab, "advancedFonts"));
   let fontc = wait_for_frame_load(
-    content_tab_e(prefTab, "dialogOverlay-0").querySelector("browser"),
+    prefTab.browser.contentDocument
+           .getAnonymousElementByAttribute(
+             prefTab.browser.contentDocument.documentElement, "id",
+             "dialogOverlay-0")
+           .querySelector("browser"),
     "chrome://messenger/content/preferences/fonts.xul"
   );
 
   // The font pickers are populated async so we need to wait for it.
   for (let fontElemId of ["serif", "sans-serif", "monospace"]) {
     fontc.waitFor(() => fontc.e(fontElemId).label != "",
                   "Timeout waiting for font picker '" + fontElemId + "' to populate.");
   }
--- a/mail/themes/shared/mail/incontentprefs/aboutPreferences.css
+++ b/mail/themes/shared/mail/incontentprefs/aboutPreferences.css
@@ -15,17 +15,17 @@
 #MailPreferences > .prefWindow-dlgbuttons {
   display: none;
 }
 
 #prefBox {
   position: relative;
 }
 
-#category-box {
+#pref-category-box {
   background-color: #ebebef;
   width: 240px;
 }
 
 caption {
   font-size: 1.14em;
   font-weight: 600;
   margin: 4px 0 !important;
@@ -135,17 +135,17 @@ radio[pane] > .radio-check {
   fill-opacity: 0.8;
 }
 
 radio[pane][selected] > .radio-check {
   fill-opacity: 1;
 }
 
 @media (max-width: 830px) {
-  #category-box {
+  #pref-category-box {
     width: 118px;
   }
 
   radio[pane] > .radio-label-box {
     display: none;
   }
 
   radio[pane] {