Bug 1599549 - Restructure all <xul:dialog> usages such that they are not the top level element in mailnews/. r=mkmelin
authorKhushil Mistry <khushil324@gmail.com>
Wed, 11 Dec 2019 17:29:12 +1300
changeset 37730 076379af5446a147ee5a053693168bdda3a37884
parent 37729 dc3343c12b98d572b37999633b541367c5cc2010
child 37731 4fdb9c85df1fa282053f122f4fe90fb869a7215e
push id397
push userclokep@gmail.com
push dateMon, 10 Feb 2020 21:16:13 +0000
reviewersmkmelin
bugs1599549
Bug 1599549 - Restructure all <xul:dialog> usages such that they are not the top level element in mailnews/. r=mkmelin
mail/test/mozmill/account/test-archive-options.js
mail/test/mozmill/shared-modules/AccountManagerHelpers.jsm
mailnews/addrbook/content/abAddressBookNameDialog.js
mailnews/addrbook/content/abAddressBookNameDialog.xul
mailnews/addrbook/content/abMailListDialog.js
mailnews/addrbook/prefs/content/pref-directory-add.xul
mailnews/addrbook/prefs/content/pref-editdirectories.xul
mailnews/addrbook/test/browser/browser_mailing_lists.js
mailnews/addrbook/test/browser/head.js
mailnews/base/content/folderProps.js
mailnews/base/content/folderProps.xul
mailnews/base/content/junkLog.xul
mailnews/base/content/junkMailInfo.xul
mailnews/base/content/markByDate.xul
mailnews/base/content/msgSelectOfflineFolders.xul
mailnews/base/content/msgSynchronize.xul
mailnews/base/content/newFolderDialog.js
mailnews/base/content/newFolderDialog.xul
mailnews/base/content/renameFolderDialog.js
mailnews/base/content/renameFolderDialog.xul
mailnews/base/content/shutdownWindow.xul
mailnews/base/content/subscribe.xul
mailnews/base/content/virtualFolderListEdit.xul
mailnews/base/content/virtualFolderProperties.js
mailnews/base/content/virtualFolderProperties.xul
mailnews/base/prefs/content/AccountManager.xul
mailnews/base/prefs/content/SmtpServerEdit.xul
mailnews/base/prefs/content/am-archiveoptions.xul
mailnews/base/prefs/content/am-identities-list.xul
mailnews/base/prefs/content/am-identity-edit.xul
mailnews/base/prefs/content/am-server-advanced.xul
mailnews/base/prefs/content/removeAccount.js
mailnews/base/prefs/content/removeAccount.xul
mailnews/base/search/content/CustomHeaders.js
mailnews/base/search/content/CustomHeaders.xul
mailnews/base/search/content/FilterEditor.xul
mailnews/base/search/content/viewLog.xul
mailnews/compose/content/askSendFormat.xul
mailnews/compose/content/sendProgress.xul
mailnews/extensions/smime/content/certFetchingStatus.xul
mailnews/extensions/smime/content/certpicker.xul
mailnews/extensions/smime/content/msgCompSecurityInfo.xul
mailnews/extensions/smime/content/msgReadSecurityInfo.xul
mailnews/import/content/fieldMapImport.xul
mailnews/news/content/downloadheaders.js
--- a/mail/test/mozmill/account/test-archive-options.js
+++ b/mail/test/mozmill/account/test-archive-options.js
@@ -96,58 +96,59 @@ function test_archive_options_enabled() 
   open_advanced_settings(function(amc) {
     subtest_check_archive_options_enabled(amc, defaultAccount.key, false);
   });
 
   MailServices.accounts.removeAccount(account);
 }
 
 function subtest_initial_state(identity) {
-  plan_for_modal_dialog("archive-options", function(ac) {
+  plan_for_modal_dialog("Mailnews:archiveOptions", function(ac) {
     assert_equals(
       ac.e("archiveGranularity").selectedIndex,
       identity.archiveGranularity
     );
     assert_equals(
       ac.e("archiveKeepFolderStructure").checked,
       identity.archiveKeepFolderStructure
     );
   });
   mc.window.openDialog(
     "chrome://messenger/content/am-archiveoptions.xul",
     "",
     "centerscreen,chrome,modal,titlebar,resizable=yes",
     identity
   );
-  wait_for_modal_dialog("archive-options");
+  wait_for_modal_dialog("Mailnews:archiveOptions");
 }
 
 function test_open_archive_options() {
   for (let granularity = 0; granularity < 3; granularity++) {
     defaultIdentity.archiveGranularity = granularity;
     for (let kfs = 0; kfs < 2; kfs++) {
       defaultIdentity.archiveKeepFolderStructure = kfs;
       subtest_initial_state(defaultIdentity);
     }
   }
 }
 
 function subtest_save_state(identity, granularity, kfs) {
-  plan_for_modal_dialog("archive-options", function(ac) {
+  plan_for_modal_dialog("Mailnews:archiveOptions", function(ac) {
     ac.e("archiveGranularity").selectedIndex = granularity;
     ac.e("archiveKeepFolderStructure").checked = kfs;
     ac.keypress(null, "VK_RETURN", {});
+    ac.window.document.querySelector("dialog").acceptDialog();
   });
   mc.window.openDialog(
     "chrome://messenger/content/am-archiveoptions.xul",
     "",
     "centerscreen,chrome,modal,titlebar,resizable=yes",
     identity
   );
-  wait_for_modal_dialog("archive-options");
+  wait_for_modal_dialog("Mailnews:archiveOptions");
 }
 
 function test_save_archive_options() {
   defaultIdentity.archiveGranularity = 0;
   defaultIdentity.archiveKeepFolderStructure = false;
   subtest_save_state(defaultIdentity, 1, true);
 
   assert_equals(defaultIdentity.archiveGranularity, 1);
--- a/mail/test/mozmill/shared-modules/AccountManagerHelpers.jsm
+++ b/mail/test/mozmill/shared-modules/AccountManagerHelpers.jsm
@@ -171,17 +171,17 @@ function remove_account(
 ) {
   let accountRow = get_account_tree_row(
     aAccount.key,
     "am-server.xul",
     aController
   );
   click_account_tree_row(aController, accountRow);
 
-  wh.plan_for_modal_dialog("removeAccountDialog", function(cdc) {
+  wh.plan_for_modal_dialog("Mailnews:removeAccount", function(cdc) {
     // Account removal confirmation dialog. Select what to remove.
     if (aRemoveAccount) {
       cdc.click(
         new elib.Elem(cdc.window.document.getElementById("removeAccount"))
       );
     }
     if (aRemoveData) {
       cdc.click(
@@ -200,11 +200,11 @@ function remove_account(
   });
 
   aAccount = null;
   // Use the Remove item in the Account actions menu.
   aController.click(aController.eid("accountActionsButton"));
   aController.click_menus_in_sequence(aController.e("accountActionsDropdown"), [
     { id: "accountActionsDropdownRemove" },
   ]);
-  wh.wait_for_modal_dialog("removeAccountDialog");
+  wh.wait_for_modal_dialog("Mailnews:removeAccount");
   // TODO: For unknown reason this also closes the whole account manager.
 }
--- a/mailnews/addrbook/content/abAddressBookNameDialog.js
+++ b/mailnews/addrbook/content/abAddressBookNameDialog.js
@@ -16,17 +16,17 @@ var gDirectory = null;
 
 var kPersonalAddressbookURI = "jsaddrbook://abook.sqlite";
 var kCollectedAddressbookURI = "jsaddrbook://history.sqlite";
 var kAllDirectoryRoot = "moz-abdirectory://";
 var kJSDirectory = 101; // defined in nsDirPrefs.h
 
 function abNameOnLoad() {
   // Get the document elements.
-  gOkButton = document.documentElement.getButton("accept");
+  gOkButton = document.querySelector("dialog").getButton("accept");
   gNameInput = document.getElementById("name");
 
   // look in arguments[0] for parameters to see if we have a directory or not
   if (
     "arguments" in window &&
     window.arguments[0] &&
     "selectedDirectory" in window.arguments[0]
   ) {
@@ -51,17 +51,17 @@ function abNameOnLoad() {
     gDirectory &&
     (gDirectory.URI == kCollectedAddressbookURI ||
       gDirectory.URI == kPersonalAddressbookURI ||
       gDirectory.URI == kAllDirectoryRoot + "?")
   ) {
     // Address book name is not editable, therefore disable the field and
     // only have an ok button that doesn't do anything.
     gNameInput.readOnly = true;
-    document.documentElement.buttons = "accept";
+    document.querySelector("dialog").buttons = "accept";
   } else {
     document.addEventListener("dialogaccept", abNameOKButton);
     gNameInput.focus();
     abNameDoOkEnabling();
   }
 }
 
 function abNameOKButton(event) {
--- a/mailnews/addrbook/content/abAddressBookNameDialog.xul
+++ b/mailnews/addrbook/content/abAddressBookNameDialog.xul
@@ -1,28 +1,29 @@
 <?xml version="1.0"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/input-fields.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/addressbook/abAddressBookNameDialog.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/addressbook/abAddressBookNameDialog.dtd">
 
-<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         style="width: 36em;"
         onload="abNameOnLoad();">
-
+<dialog>
   <stringbundle id="bundle_addressBook" src="chrome://messenger/locale/addressbook/addressBook.properties"/>
 
   <script src="chrome://global/content/globalOverlay.js"/>
   <script src="chrome://global/content/editMenuOverlay.js"/>
   <script src="chrome://messenger/content/addressbook/abAddressBookNameDialog.js"/>
 
   <hbox align="center" class="input-container">
     <label id="nameLabel" control="name" value="&name.label;"
            accesskey="&name.accesskey;"/>
     <html:input id="name" type="text" class="input-inline"
                 aria-labelledby="nameLabel" oninput="abNameDoOkEnabling();"/>
   </hbox>
 </dialog>
+</window>
--- a/mailnews/addrbook/content/abMailListDialog.js
+++ b/mailnews/addrbook/content/abMailListDialog.js
@@ -297,17 +297,17 @@ function OnLoadEditList() {
   // read-only.
   if (gEditList.readOnly) {
     const kMailListFields = ["ListName", "ListNickName", "ListDescription"];
 
     for (let i = 0; i < kMailListFields.length; ++i) {
       document.getElementById(kMailListFields[i]).readOnly = true;
     }
 
-    document.documentElement.buttons = "accept";
+    document.querySelector("dialog").buttons = "accept";
 
     // Getting a sane read-only implementation for the addressing widget would
     // basically need a separate dialog. Given I'm not sure about the future of
     // the mailing list dialog in its current state, let's just disable it
     // completely.
     document.getElementById("addressingWidget").disabled = true;
   } else {
     document.addEventListener("dialogaccept", EditListOKButton);
--- a/mailnews/addrbook/prefs/content/pref-directory-add.xul
+++ b/mailnews/addrbook/prefs/content/pref-directory-add.xul
@@ -2,27 +2,26 @@
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/shared/grid-layout.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/input-fields.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/addressbook/pref-directory-add.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/addressbook/pref-directory-add.dtd">
 
-<dialog id="addDirectory"
-        style="width: &newDirectoryWidth;"
+<window style="width: &newDirectoryWidth;"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="Startup();"
-        onunload="onUnload();"
+        onunload="onUnload();">
+<dialog id="addDirectory"
         buttons="accept,cancel">
-
   <script src="chrome://global/content/globalOverlay.js"/>
   <script src="chrome://global/content/editMenuOverlay.js"/>
   <script src="chrome://messenger/content/addressbook/pref-directory-add.js"/>
   <stringbundle id="bundle_addressBook" src="chrome://messenger/locale/addressbook/addressBook.properties"/>
   <stringbundle id="bundle_replication" src="chrome://messenger/locale/addressbook/replicationProgress.properties"/>
 
   <keyset id="keyset"/>
   <vbox id="editDirectory">
@@ -166,10 +165,10 @@
                   </xul:menupopup>
                 </xul:menulist>
               </div>
             </div>
           </vbox>
       </tabpanels>
     </tabbox>
   </vbox>
-
 </dialog>
+</window>
--- a/mailnews/addrbook/prefs/content/pref-editdirectories.xul
+++ b/mailnews/addrbook/prefs/content/pref-editdirectories.xul
@@ -1,24 +1,23 @@
 <?xml version="1.0"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/addressbook/pref-directory.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/addressbook/pref-directory.dtd">
 
-<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
-        id="editDirectories"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
         title="&pref.ldap.window.title;"
-        buttons="accept"
         onload="onInitEditDirectories();"
         onunload="onUninitEditDirectories();">
-
+<dialog id="editDirectories"
+        buttons="accept">
   <script src="chrome://messenger/content/addressbook/abCommon.js"/>
   <script src="chrome://messenger/content/addressbook/pref-editdirectories.js"/>
 
   <stringbundle id="bundle_addressBook"
                 src="chrome://messenger/locale/addressbook/addressBook.properties"/>
 
   <label value="&directoriesText.label;"
          accesskey="&directoriesText.accesskey;" control="directoriesList"/>
@@ -35,8 +34,9 @@
               accesskey="&editDirectory.accesskey;" disabled="true"
               oncommand="editDirectory();"/>
       <button id="removeButton" label="&deleteDirectory.label;"
               accesskey="&deleteDirectory.accesskey;" disabled="true"
               oncommand="removeDirectory();"/>
     </vbox>
   </hbox>
 </dialog>
+</window>
--- a/mailnews/addrbook/test/browser/browser_mailing_lists.js
+++ b/mailnews/addrbook/test/browser/browser_mailing_lists.js
@@ -61,17 +61,17 @@ add_task(async () => {
  */
 add_task(async () => {
   let mailingListWindowPromise = BrowserTestUtils.promiseAlertDialog(
     null,
     "chrome://messenger/content/addressbook/abMailListDialog.xul",
     // A callback that can interact with the mailing list dialog.
     async mlWindow => {
       let mlDocument = mlWindow.document;
-      let mlDocElement = mlDocument.documentElement;
+      let mlDocElement = mlDocument.querySelector("dialog");
 
       let listName = mlDocument.getElementById("ListName");
       let listNameFocusEvent = await BrowserTestUtils.waitForEvent(
         listName,
         "focus"
       );
 
       let abPopup = mlDocument.getElementById("abPopup");
@@ -198,17 +198,17 @@ add_task(async () => {
  */
 add_task(async () => {
   let mailingListWindowPromise = BrowserTestUtils.promiseAlertDialog(
     null,
     "chrome://messenger/content/addressbook/abEditListDialog.xul",
     // A callback that can interact with the mailing list dialog.
     async mlWindow => {
       let mlDocument = mlWindow.document;
-      let mlDocElement = mlDocument.documentElement;
+      let mlDocElement = mlDocument.querySelector("dialog");
 
       // The address input nodes are not there yet when the dialog window is
       // loaded, so wait until they exist.
       await mailTestUtils.awaitElementExistence(
         MutationObserver,
         mlDocument,
         "addressingWidget",
         "addressCol1#3"
@@ -375,17 +375,17 @@ add_task(async () => {
  */
 add_task(async () => {
   let mailingListWindowPromise = BrowserTestUtils.promiseAlertDialog(
     null,
     "chrome://messenger/content/addressbook/abEditListDialog.xul",
     // A callback that can interact with the mailing list dialog.
     async mailingListWindow => {
       let mlDocument = mailingListWindow.document;
-      let mlDocElement = mlDocument.documentElement;
+      let mlDocElement = mlDocument.querySelector("dialog");
 
       // The address input nodes are not there yet when the dialog window is
       // loaded, so wait until they exist.
       await mailTestUtils.awaitElementExistence(
         MutationObserver,
         mlDocument,
         "addressingWidget",
         "addressCol1#4"
--- a/mailnews/addrbook/test/browser/head.js
+++ b/mailnews/addrbook/test/browser/head.js
@@ -31,17 +31,20 @@ async function openAddressBookWindow() {
 }
 
 async function createNewAddressBook(abWindow, abName) {
   let newAddressBookPromise = BrowserTestUtils.promiseAlertDialog(
     null,
     "chrome://messenger/content/addressbook/abAddressBookNameDialog.xul",
     abNameDialog => {
       EventUtils.sendString(abName, abNameDialog);
-      abNameDialog.document.documentElement.getButton("accept").click();
+      abNameDialog.document
+        .querySelector("dialog")
+        .getButton("accept")
+        .click();
     }
   );
 
   // Using the UI was unreliable so just call the function.
   abWindow.AbNewAddressBook();
 
   await newAddressBookPromise;
 
--- a/mailnews/base/content/folderProps.js
+++ b/mailnews/base/content/folderProps.js
@@ -99,17 +99,19 @@ var gFolderPropsSink = {
         percentUsed.setAttribute("value", percentUsedCaption);
       }
     }
   },
 };
 
 function doEnabling() {
   var nameTextbox = document.getElementById("name");
-  document.documentElement.getButton("accept").disabled = !nameTextbox.value;
+  document
+    .querySelector("dialog")
+    .getButton("accept").disabled = !nameTextbox.value;
 }
 
 function folderPropsOKButton(event) {
   if (gMsgFolder) {
     // set charset attributes
     var folderCharsetList = document.getElementById("folderCharsetList");
 
     // Log to the Error Console the charset value for the folder
--- a/mailnews/base/content/folderProps.xul
+++ b/mailnews/base/content/folderProps.xul
@@ -2,26 +2,25 @@
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://global/skin/global.css"?>
 <?xml-stylesheet href="chrome://messenger/skin/messenger.css"?>
 <?xml-stylesheet href="chrome://messenger/skin/input-fields.css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/folderProps.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/folderProps.dtd">
 
-<dialog id="folderPropertiesDialog"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="&folderProps.windowtitle.label;"
-        buttons="accept,cancel"
         onload="folderPropsOnLoad();"
         style="width: 56ch;">
-
+<dialog id="folderPropertiesDialog"
+        buttons="accept,cancel">
   <stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
   <script src="chrome://global/content/globalOverlay.js"/>
   <script src="chrome://global/content/editMenuOverlay.js"/>
   <script src="chrome://messenger/content/retention.js"/>
   <script src="chrome://messenger/content/folderProps.js"/>
   <script src="chrome://messenger/content/menulist-charsetpicker.js"/>
 
 <tabbox id="folderPropTabBox">
@@ -208,10 +207,10 @@
             <html:progress id="quotaPercentageBar" value="0" max="100"/>
             <label id="quotaPercentUsed"/>
           </hbox>
         </vbox>
       </hbox>
     </vbox>
   </tabpanels>
 </tabbox>
-
 </dialog>
+</window>
--- a/mailnews/base/content/junkLog.xul
+++ b/mailnews/base/content/junkLog.xul
@@ -2,29 +2,28 @@
 
 <!-- -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
    - This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/junkLog.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/junkLog.dtd">
 
-<dialog id="viewLogWindow"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
         onload="onLoad();"
         title="&adaptiveJunkLog.title;"
         windowtype="mailnews:junklog"
+        persist="screenX screenY width height"
+        style="width: 40em; height: 25em;">
+<dialog id="viewLogWindow"
         buttons="accept"
         buttonlabelaccept="&closeLog.label;"
-        buttonaccesskeyaccept="&closeLog.accesskey;"
-        persist="screenX screenY width height"
-        style="width: 40em; height: 25em;">
-
+        buttonaccesskeyaccept="&closeLog.accesskey;">
   <script src="chrome://messenger/content/junkLog.js"/>
 
   <vbox flex="1">
     <hbox>
       <label value="&adaptiveJunkLogInfo.label;"/>
       <spacer flex="1"/>
       <button label="&clearLog.label;"
               accesskey="&clearLog.accesskey;"
@@ -37,8 +36,9 @@
                disablehistory="true"
                disablesecurity="true"
                src="about:blank"
                autofind="false"
                flex="1"/>
     </hbox>
   </vbox>
 </dialog>
+</window>
--- a/mailnews/base/content/junkMailInfo.xul
+++ b/mailnews/base/content/junkMailInfo.xul
@@ -1,35 +1,35 @@
 <?xml version="1.0"?>
 
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
-<!DOCTYPE dialog [
+<!DOCTYPE window [
 <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
 %brandDTD;
 <!ENTITY % junkMailInfoDTD SYSTEM "chrome://messenger/locale/junkMailInfo.dtd" >
 %junkMailInfoDTD;
 ]>
 
 <?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/primaryToolbar.css" type="text/css"?>
 
-<dialog id="junkMailInfo"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
         title="&window.title;"
-        windowtype="mailnews:junkmailinfo"
+        windowtype="mailnews:junkmailinfo">
+<dialog id="junkMailInfo"
         buttons="accept">
-
   <vbox flex="1" width="&window.width;">
       <spacer/>
       <description>&info1a.label;<image align="center" id="junkIcon"/>&info1b.label;</description>
       <spacer/>
       <description>&info2.label;</description>
       <spacer/>
       <description>&info3.label;</description>
 #ifndef MOZ_THUNDERBIRD
       <spacer/>
       <description>&info4.label;</description>
 #endif
   </vbox>
 </dialog>
+</window>
--- a/mailnews/base/content/markByDate.xul
+++ b/mailnews/base/content/markByDate.xul
@@ -2,24 +2,23 @@
 
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/input-fields.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/markByDate.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/markByDate.dtd">
 
-<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="&messageMarkByDate.label;"
-        buttons="accept,cancel"
         onload="onLoad();">
-
+<dialog buttons="accept,cancel">
   <script src="chrome://global/content/globalOverlay.js"/>
   <script src="chrome://global/content/editMenuOverlay.js"/>
   <script src="chrome://messenger/content/markByDate.js"/>
   <script src="chrome://messenger/content/dateFormat.js"/>
 
   <hbox align="center" pack="end">
     <label id="lowerDateLabel" control="lowerDate"
            value="&markByDateLower.label;"
@@ -35,10 +34,10 @@
            value="&markByDateUpper.label;"
            accesskey="&markByDateUpper.accesskey;"/>
     <html:input id="upperDate"
                 type="text"
                 class="input-inline"
                 aria-labelledby="upperDateLabel"
                 size="11"/>
   </hbox>
-
 </dialog>
+</window>
--- a/mailnews/base/content/msgSelectOfflineFolders.xul
+++ b/mailnews/base/content/msgSelectOfflineFolders.xul
@@ -1,25 +1,24 @@
 <?xml version="1.0"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/msgSelectOffline.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/msgSynchronize.dtd" >
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/msgSynchronize.dtd" >
 
-<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
-        id="select-offline"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
         windowtype="mailnews:selectOffline"
         title="&MsgSelect.label;"
         width="450" height="400"
         persist="width height"
         onload="gSelectOffline.load();">
-
+<dialog id="select-offline">
   <stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
   <stringbundle id="bundle_brand" src="chrome://branding/locale/brand.properties"/>
 
   <script src="chrome://messenger/content/msgSelectOfflineFolders.js"/>
   <script src="chrome://messenger/content/folderPane.js"/>
 
   <label class="desc" control="synchronizeTree">&MsgSelectDesc.label;</label>
 
@@ -35,10 +34,10 @@
     <treecols>
       <treecol id="folderNameCol" flex="5" persist="hidden width" label="&MsgSelectItems.label;" primary="true"/>
       <splitter class="tree-splitter"/>
       <treecol id="syncCol" flex="1" persist="hidden width" label="&MsgSelectInd.label;" cycler="true"/>
     </treecols>
 
     <treechildren/>
   </tree>
-
 </dialog>
+</window>
--- a/mailnews/base/content/msgSynchronize.xul
+++ b/mailnews/base/content/msgSynchronize.xul
@@ -3,25 +3,24 @@
 <!--
 
  This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/msgSynchronize.dtd" >
-<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
-        id="msg-synchronizer"
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/msgSynchronize.dtd" >
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
         windowtype="mailnews:synchronizeOffline"
         title="&MsgSynchronize.label;"
         onload="OnLoad();"
         style="width: 35em;">
-
-<script src="chrome://messenger/content/msgSynchronize.js"/>
+<dialog id="msg-synchronizer">
+    <script src="chrome://messenger/content/msgSynchronize.js"/>
 
     <keyset id="keyset"/>
     <label hidden="true" wsm_persist="true" id="server.type"/>
 
     <description class="desc">&MsgSyncDesc.label;</description>
     <separator class="thin"/>
     <label value="&MsgSyncDirections.label;"/>
 
@@ -35,8 +34,9 @@
         <checkbox id="workOffline" label="&workOffline.label;" accesskey="&workOffline.accesskey;"/>
     </vbox>
     <separator class="thin"/>
     <hbox pack="end">
         <button id="select" label="&selectButton.label;" accesskey="&selectButton.accesskey;"
                 oncommand="OnSelect();"/>
     </hbox>
 </dialog>
+</window>
--- a/mailnews/base/content/newFolderDialog.js
+++ b/mailnews/base/content/newFolderDialog.js
@@ -73,11 +73,11 @@ function onFoldersOnly() {
   dialog.folderType = FOLDERS;
 }
 
 function onMessagesOnly() {
   dialog.folderType = MESSAGES;
 }
 
 function doEnabling() {
-  document.documentElement.getButton("accept").disabled = !dialog.nameField
-    .value;
+  document.querySelector("dialog").getButton("accept").disabled = !dialog
+    .nameField.value;
 }
--- a/mailnews/base/content/newFolderDialog.xul
+++ b/mailnews/base/content/newFolderDialog.xul
@@ -4,27 +4,26 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/folderMenus.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/input-fields.css" type="text/css"?>
 
-<!DOCTYPE dialog [
+<!DOCTYPE window [
 <!ENTITY % newFolderDTD SYSTEM "chrome://messenger/locale/newFolderDialog.dtd">%newFolderDTD;
 ]>
 
-<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="&newFolderDialog.title;"
-        onload="onLoad();"
-        buttonlabelaccept="&accept.label;"
+        onload="onLoad();">
+<dialog buttonlabelaccept="&accept.label;"
         buttonaccesskeyaccept="&accept.accesskey;">
-
   <script src="chrome://global/content/globalOverlay.js"/>
   <script src="chrome://global/content/editMenuOverlay.js"/>
   <script src="chrome://messenger/content/newFolderDialog.js"/>
 
     <label id="nameLabel" value="&name.label;" accesskey="&name.accesskey;"
            control="name"/>
     <html:input id="name"
                 type="text"
@@ -55,10 +54,10 @@
       <separator class="thin"/>
 
       <radiogroup id="folderGroup" orient="horizontal" class="indent">
         <radio oncommand="onFoldersOnly();" label="&foldersOnly.label;"/>
         <radio oncommand="onMessagesOnly();" label="&messagesOnly.label;" selected="true"/>
       </radiogroup>
 
     </vbox>
-
 </dialog>
+</window>
--- a/mailnews/base/content/renameFolderDialog.js
+++ b/mailnews/base/content/renameFolderDialog.js
@@ -8,17 +8,17 @@ var dialog;
 
 document.addEventListener("dialogaccept", onOK);
 
 function onLoad() {
   var windowArgs = window.arguments[0];
 
   dialog = {};
 
-  dialog.OKButton = document.documentElement.getButton("accept");
+  dialog.OKButton = document.querySelector("dialog").getButton("accept");
 
   dialog.nameField = document.getElementById("name");
   dialog.nameField.value = windowArgs.name;
   dialog.nameField.select();
   dialog.nameField.focus();
 
   // call this when OK is pressed
   dialog.okCallback = windowArgs.okCallback;
--- a/mailnews/base/content/renameFolderDialog.xul
+++ b/mailnews/base/content/renameFolderDialog.xul
@@ -1,29 +1,29 @@
 <?xml version="1.0"?> <!-- -*- Mode: xml; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- -->
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/input-fields.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/renameFolderDialog.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/renameFolderDialog.dtd">
 
-<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="&renameFolderDialog.title;"
-        buttonlabelaccept="&accept.label;"
-        buttonaccesskeyaccept="&accept.accesskey;"
         onload="onLoad();">
-
+<dialog buttonlabelaccept="&accept.label;"
+        buttonaccesskeyaccept="&accept.accesskey;">
   <script src="chrome://global/content/globalOverlay.js"/>
   <script src="chrome://global/content/editMenuOverlay.js"/>
   <script src="chrome://messenger/content/renameFolderDialog.js"/>
 
   <label id="nameLabel" value="&rename.label;" accesskey="&rename.accesskey;"
          control="name"/>
   <html:input id="name"
               type="text"
               class="input-inline"
               aria-labelledby="nameLabel"
               oninput="doEnabling();"/>
 </dialog>
+</window>
--- a/mailnews/base/content/shutdownWindow.xul
+++ b/mailnews/base/content/shutdownWindow.xul
@@ -2,30 +2,29 @@
 <!--
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 -->
 
 <?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
 
-<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         style="padding: 20px; width: 350px"
-        onload="onLoad()"
-        buttons="cancel">
-
+        onload="onLoad()">
+<dialog buttons="cancel">
   <script src="chrome://messenger/content/shutdownWindow.js"/>
   <stringbundle id="bundle_shutdown" src="chrome://messenger/locale/shutdownWindow.properties"/>
 
   <vbox align="center">
     <label id="shutdownStatus_label" value="" />
     <separator class="thin" />
   </vbox>
 
   <html:progress id="shutdown_progressmeter" max="100" />
 
   <vbox align="center">
     <label id="shutdownTask_label" value="" />
     <separator class="thick" />
   </vbox>
-
 </dialog>
+</window>
--- a/mailnews/base/content/subscribe.xul
+++ b/mailnews/base/content/subscribe.xul
@@ -4,26 +4,25 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/subscribe.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/folderMenus.css" type="text/css"?>
 
 <!DOCTYPE window SYSTEM "chrome://messenger/locale/subscribe.dtd">
 
-<dialog id="subscribeWindow"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="&subscribeDialog.title;"
         style="width: 44em; height: 33em;"
         persist="width height screenX screenY"
         onload="SubscribeOnLoad()"
         onunload="SubscribeOnUnload()"
         windowtype="mailnews:subscribe">
-
+<dialog id="subscribeWindow">
   <stringbundle id="bundle_subscribe" src="chrome://messenger/locale/subscribe.properties"/>
   <stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
 
   <script src="chrome://global/content/globalOverlay.js"/>
   <script src="chrome://messenger/content/mailWindow.js"/>
   <script src="chrome://messenger/content/subscribe.js"/>
 
   <vbox flex="1" style="width: 40em; height: 25em;">
@@ -165,8 +164,9 @@
                          value="0"
                          max="100"/>
         </hbox>
       </hbox>
       <hbox/>
     </hbox>
   </vbox>
 </dialog>
+</window>
--- a/mailnews/base/content/virtualFolderListEdit.xul
+++ b/mailnews/base/content/virtualFolderListEdit.xul
@@ -3,24 +3,23 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/.
    -->
 
 <?xml-stylesheet href="chrome://messenger/skin/virtualFolderListDialog.css" type="text/css"?>
 
 <!DOCTYPE window SYSTEM "chrome://messenger/locale/virtualFolderListDialog.dtd">
 
-<dialog id="searchFolderWindow"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
         title="&virtualFolderListTitle.title;"
         windowtype="mailnews:virtualFolderList"
         style="width: 27em; height: 25em;"
         persist="width height screenX screenY"
         onload="gSelectVirtual.load();">
-
+<dialog id="searchFolderWindow">
   <script src="chrome://messenger/content/virtualFolderListEdit.js"/>
   <script src="chrome://messenger/content/folderPane.js"/>
 
   <stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
 
   <label control="folderPickerTree">&virtualFolderDesc.label;</label>
 
     <tree id="folderPickerTree"
@@ -36,8 +35,9 @@
         <treecol id="folderNameCol" label="&folderName.label;"
                  flex="10" primary="true" crop="center"/>
         <treecol id="selectedCol" label="&folderSearch.label;" flex="1" cycler="true"/>
       </treecols>
 
       <treechildren/>
     </tree>
 </dialog>
+</window>
--- a/mailnews/base/content/virtualFolderProperties.js
+++ b/mailnews/base/content/virtualFolderProperties.js
@@ -28,42 +28,42 @@ var { fixIterator } = ChromeUtils.import
   "resource:///modules/iteratorUtils.jsm"
 );
 var { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 document.addEventListener("dialogaccept", onOK);
 
 function onLoad() {
   var windowArgs = window.arguments[0];
-  var acceptButton = document.documentElement.getButton("accept");
+  var acceptButton = document.querySelector("dialog").getButton("accept");
 
   gMessengerBundle = document.getElementById("bundle_messenger");
 
   // call this when OK is pressed
   msgWindow = windowArgs.msgWindow; // eslint-disable-line no-global-assign
 
   initializeSearchWidgets();
 
   setSearchScope(nsMsgSearchScope.offlineMail);
   if (windowArgs.editExistingFolder) {
-    acceptButton.label = document.documentElement.getAttribute(
-      "editFolderAcceptButtonLabel"
-    );
-    acceptButton.accesskey = document.documentElement.getAttribute(
-      "editFolderAcceptButtonAccessKey"
-    );
+    acceptButton.label = document
+      .querySelector("dialog")
+      .getAttribute("editFolderAcceptButtonLabel");
+    acceptButton.accesskey = document
+      .querySelector("dialog")
+      .getAttribute("editFolderAcceptButtonAccessKey");
     InitDialogWithVirtualFolder(windowArgs.folder);
   } else {
     // we are creating a new virtual folder
-    acceptButton.label = document.documentElement.getAttribute(
-      "newFolderAcceptButtonLabel"
-    );
-    acceptButton.accesskey = document.documentElement.getAttribute(
-      "newFolderAcceptButtonAccessKey"
-    );
+    acceptButton.label = document
+      .querySelector("dialog")
+      .getAttribute("newFolderAcceptButtonLabel");
+    acceptButton.accesskey = document
+      .querySelector("dialog")
+      .getAttribute("newFolderAcceptButtonAccessKey");
     // it is possible that we were given arguments to pre-fill the dialog with...
     gSearchTermSession = Cc[
       "@mozilla.org/messenger/searchSession;1"
     ].createInstance(Ci.nsIMsgSearchSession);
 
     if (windowArgs.searchTerms) {
       // then add them to our search session
       for (let searchTerm of fixIterator(
@@ -244,17 +244,17 @@ function onOK(event) {
       gSearchFolderURIs,
       gSearchTermSession.searchTerms,
       searchOnline
     );
   }
 }
 
 function doEnabling() {
-  var acceptButton = document.documentElement.getButton("accept");
+  var acceptButton = document.querySelector("dialog").getButton("accept");
   acceptButton.disabled = !document.getElementById("name").value;
 }
 
 function chooseFoldersToSearch() {
   // if we have some search folders already, then root the folder picker dialog off the account
   // for those folders. Otherwise fall back to the preselectedfolderURI which is the parent folder
   // for this new virtual folder.
   window.openDialog(
--- a/mailnews/base/content/virtualFolderProperties.xul
+++ b/mailnews/base/content/virtualFolderProperties.xul
@@ -5,36 +5,35 @@
    -->
 
 <?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/searchDialog.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/folderMenus.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/input-fields.css" type="text/css"?>
 
-<!DOCTYPE dialog [
+<!DOCTYPE window [
   <!ENTITY % folderDTD SYSTEM "chrome://messenger/locale/virtualFolderProperties.dtd">
   %folderDTD;
   <!ENTITY % searchTermDTD SYSTEM "chrome://messenger/locale/searchTermOverlay.dtd">
   %searchTermDTD;
 ]>
 
-<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
-        id="virtualFolderPropertiesDialog"
         title="&virtualFolderProperties.title;"
         onload="onLoad();"
+        style="width: 50em; height: 28em;"
+        windowtype="mailnews:virtualFolderProperties">
+<dialog id="virtualFolderPropertiesDialog"
         buttons="accept,cancel"
         newFolderAcceptButtonLabel="&newFolderButton.label;"
         newFolderAcceptButtonAccessKey="&newFolderButton.accesskey;"
         editFolderAcceptButtonLabel="&editFolderButton.label;"
-        editFolderAcceptButtonAccessKey="&editFolderButton.accesskey;"
-        style="width: 50em; height: 28em;"
-        windowtype="mailnews:virtualFolderProperties">
-
+        editFolderAcceptButtonAccessKey="&editFolderButton.accesskey;">
   <stringbundle id="bundle_search" src="chrome://messenger/locale/search.properties"/>
   <stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
   <stringbundle id="bundle_folder" src="chrome://messenger/locale/folderWidgets.properties"/>
 
   <script src="chrome://global/content/globalOverlay.js"/>
   <script src="chrome://global/content/editMenuOverlay.js"/>
   <script src="chrome://messenger/content/searchWidgets.js"/>
   <script src="chrome://messenger/content/mailCommands.js"/>
@@ -92,11 +91,10 @@
 
   <vbox flex="2">
     <label value="&searchTermCaption.label;"/>
     <hbox flex="1">
       <vbox id="searchTermListBox" flex="2">
 #include ../search/content/searchTerm.inc.xul
     </hbox>
   </vbox>
-
 </dialog>
-
+</window>
--- a/mailnews/base/prefs/content/AccountManager.xul
+++ b/mailnews/base/prefs/content/AccountManager.xul
@@ -1,26 +1,26 @@
 <?xml version="1.0"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/folderPane.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/accountManage.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/AccountManager.dtd">
-<dialog id="accountManager"
-        windowtype="mailnews:accountmanager"
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/AccountManager.dtd">
+<window windowtype="mailnews:accountmanager"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
         title="&accountManagerTitle.label;"
         style="&accountManager.size;"
         persist="width height screenX screenY"
-        buttons="accept,cancel"
         onload="onLoad(event);"
         onunload="onUnload();">
+<dialog id="accountManager"
+        buttons="accept,cancel">
 <stringbundle id="bundle_brand" src="chrome://branding/locale/brand.properties"/>
 <stringbundle id="bundle_prefs" src="chrome://messenger/locale/prefs.properties"/>
 <script src="chrome://messenger/content/accountUtils.js"/>
 <script src="chrome://messenger/content/am-prefs.js"/>
 <script src="chrome://messenger/content/AccountManager.js"/>
 #ifdef MOZ_SUITE
 <script src="chrome://messenger/content/am-help.js"/>
 #endif
@@ -86,8 +86,9 @@
               prefstring="mail.disable_button.delete_account"
               accesskey="&removeButton.accesskey;"/>
 #endif
     </vbox>
 
     <iframe id="contentFrame" name="contentFrame" flex="1"/>
   </hbox>
 </dialog>
+</window>
--- a/mailnews/base/prefs/content/SmtpServerEdit.xul
+++ b/mailnews/base/prefs/content/SmtpServerEdit.xul
@@ -2,22 +2,23 @@
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/input-fields.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/smtpEditOverlay.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/smtpEditOverlay.dtd">
 
-<dialog title="&smtpEditTitle.label;"
+<window title="&smtpEditTitle.label;"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         onload="onLoad();">
+<dialog>
   <stringbundle id="bundle_prefs"
                 src="chrome://messenger/locale/prefs.properties"/>
   <stringbundle id="bundle_brand"
                 src="chrome://branding/locale/brand.properties"/>
   <stringbundle id="bundle_messenger"
                 src="chrome://messenger/locale/messenger.properties"/>
 
   <script src="chrome://global/content/globalOverlay.js"/>
@@ -130,8 +131,9 @@
                       preftype="string"
                       prefstring="mail.smtpserver.%serverkey%.username"
                       aria-labelledby="smtp.username.label"/>
         </vbox>
       </hbox>
     </groupbox>
   </vbox>
 </dialog>
+</window>
--- a/mailnews/base/prefs/content/am-archiveoptions.xul
+++ b/mailnews/base/prefs/content/am-archiveoptions.xul
@@ -2,25 +2,25 @@
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/accountManage.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/folderPane.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/am-archiveoptions.dtd" >
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/am-archiveoptions.dtd" >
 
-<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
-        id="archive-options"
+<window windowtype="Mailnews:archiveOptions"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
         title="&dialogTitle.label;"
         width="350" height="350"
         persist="width height"
         onload="onLoadArchiveOptions();">
-
+<dialog id="archive-options">
   <script src="chrome://messenger/content/am-archiveoptions.js"/>
 
   <vbox flex="1">
     <label>&archiveGranularityPrefix.label;</label>
     <radiogroup id="archiveGranularity">
       <radio label="&archiveFlat.label;" accesskey="&archiveFlat.accesskey;"
              class="indent"/>
       <radio label="&archiveYearly.label;"
@@ -91,8 +91,9 @@
               </treeitem>
             </treechildren>
           </treeitem>
         </treechildren>
       </tree>
     </groupbox>
   </vbox>
 </dialog>
+</window>
--- a/mailnews/base/prefs/content/am-identities-list.xul
+++ b/mailnews/base/prefs/content/am-identities-list.xul
@@ -2,26 +2,24 @@
 
 <?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/accountManage.css" type="text/css"?>
 
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/am-identities-list.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/am-identities-list.dtd">
 
-<dialog
-  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
-  onload="onLoad();"
-  buttons="accept"
-  buttonlabelaccept="&identitiesListClose.label;"
-  buttonaccesskeyaccept="&identitiesListClose.accesskey;"
-  style="width: 40em;">
-
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
+        onload="onLoad();"
+        style="width: 40em;">
+<dialog buttons="accept"
+        buttonlabelaccept="&identitiesListClose.label;"
+        buttonaccesskeyaccept="&identitiesListClose.accesskey;">
 <stringbundle id="bundle_prefs" src="chrome://messenger/locale/prefs.properties"/>
 <script src="chrome://messenger/content/am-identities-list.js"/>
 
 <commandset>
   <command id="cmd_add"     oncommand="openIdentityEditor(null);"/>
   <command id="cmd_edit"    oncommand="onEdit(event);" disabled="true"/>
   <command id="cmd_default" oncommand="onSetDefault(event);" disabled="true"/>
   <command id="cmd_delete"  oncommand="onDelete(event);" disabled="true"/>
@@ -54,10 +52,10 @@
     <button id="setDefaultButton" disabled="true"
             command="cmd_default" label="&identitiesListDefault.label;"
             accesskey="&identitiesListDefault.accesskey;"/>
     <button id="deleteButton" disabled="true"
             command="cmd_delete" label="&identitiesListDelete.label;"
             accesskey="&identitiesListDelete.accesskey;"/>
   </vbox>
 </hbox>
-
 </dialog>
+</window>
--- a/mailnews/base/prefs/content/am-identity-edit.xul
+++ b/mailnews/base/prefs/content/am-identity-edit.xul
@@ -3,35 +3,34 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/folderMenus.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/accountManage.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/input-fields.css" type="text/css"?>
 
-<!DOCTYPE dialog [
+<!DOCTYPE window [
 <!ENTITY % identityEditDTD SYSTEM "chrome://messenger/locale/am-identity-edit.dtd" >
 %identityEditDTD;
 <!ENTITY % identityDTD SYSTEM "chrome://messenger/locale/am-main.dtd" >
 %identityDTD;
 <!ENTITY % copiesDTD SYSTEM "chrome://messenger/locale/am-copies.dtd">
 %copiesDTD;
 <!ENTITY % addressingDTD SYSTEM "chrome://messenger/locale/am-addressing.dtd" >
 %addressingDTD;
 <!ENTITY % smimeDTD SYSTEM "chrome://messenger/locale/am-smime.dtd" >
 %smimeDTD;
 ]>
 
-<dialog id="identityDialog"
-        xmlns:html="http://www.w3.org/1999/xhtml"
+<window xmlns:html="http://www.w3.org/1999/xhtml"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         onload="onLoadIdentityProperties();"
         style="&identityDialog.style;">
-
+<dialog id="identityDialog">
   <stringbundle id="bundle_prefs"
                 src="chrome://messenger/locale/prefs.properties"/>
   <stringbundle id="bundle_messenger"
                 src="chrome://messenger/locale/messenger.properties"/>
 
   <script src="chrome://global/content/globalOverlay.js"/>
   <script src="chrome://global/content/editMenuOverlay.js"/>
   <script src="chrome://messenger/content/am-prefs.js"/>
@@ -212,8 +211,9 @@
 #include am-addressing.inc.xul
 
       <!-- Security Tab -->
 #include ../../../extensions/smime/content/am-smime.inc.xul
 
     </tabpanels>
   </tabbox>
 </dialog>
+</window>
--- a/mailnews/base/prefs/content/am-server-advanced.xul
+++ b/mailnews/base/prefs/content/am-server-advanced.xul
@@ -4,24 +4,23 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/accountManage.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/folderMenus.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/input-fields.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/am-server-advanced.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/am-server-advanced.dtd">
 
-<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="&serverAdvanced.label;"
-        buttons="accept,cancel"
         onload="onLoad();">
-
+<dialog buttons="accept,cancel">
   <script src="chrome://global/content/globalOverlay.js"/>
   <script src="chrome://global/content/editMenuOverlay.js"/>
   <script src="chrome://messenger/content/am-server-advanced.js"/>
   <stringbundle id="bundle_prefs"
                 src="chrome://messenger/locale/prefs.properties"/>
 
     <label id="serverPrettyName"/>
 
@@ -147,8 +146,9 @@
                         accesskey="&deferGetNewMail.accesskey;"/>
             </vbox>
           </vbox>
         </radiogroup>
       </hbox>
 
     </vbox>
 </dialog>
+</window>
--- a/mailnews/base/prefs/content/removeAccount.js
+++ b/mailnews/base/prefs/content/removeAccount.js
@@ -11,17 +11,17 @@ var { MailServices } = ChromeUtils.impor
 var gServer;
 var gDialog;
 
 document.addEventListener("dialogdisclosure", showInfo);
 document.addEventListener("dialogaccept", onAccept);
 
 function onLoad(event) {
   gServer = window.arguments[0].account.incomingServer;
-  gDialog = document.documentElement;
+  gDialog = document.querySelector("dialog");
 
   let bundle = document.getElementById("bundle_removeAccount");
   let removeQuestion = bundle.getFormattedString("removeQuestion", [
     gServer.prettyName,
   ]);
   document.getElementById("accountName").textContent = removeQuestion;
 
   // Allow to remove account data if it has a local storage.
--- a/mailnews/base/prefs/content/removeAccount.xul
+++ b/mailnews/base/prefs/content/removeAccount.xul
@@ -1,33 +1,34 @@
 <?xml version="1.0"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
 
-<!DOCTYPE dialog [
+<!DOCTYPE window [
 <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
 %brandDTD;
 <!ENTITY % removalDTD SYSTEM "chrome://messenger/locale/removeAccount.dtd">
 %removalDTD;
 ]>
 
-<dialog id="removeAccountDialog"
+<window windowtype="Mailnews:removeAccount"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="&dialogTitle;"
         width="600"
+        onload="onLoad();">
+<dialog id="removeAccountDialog"
         buttons="accept,disclosure,cancel"
         buttonlabelaccept="&removeButton.label;"
         buttonaccesskeyaccept="&removeButton.accesskey;"
-        defaultButton="cancel"
-        onload="onLoad();">
+        defaultButton="cancel">
   <stringbundle id="bundle_removeAccount"
                 src="chrome://messenger/locale/removeAccount.properties"/>
   <script src="chrome://messenger/content/removeAccount.js"/>
   <deck id="infoPane">
     <vbox flex="1">
       <label id="accountName"></label>
       <separator class="thin"/>
       <checkbox id="removeAccount"
@@ -78,8 +79,9 @@
         </vbox>
         <label id="success">&progressSuccess;</label>
         <label id="failure">&progressFailure;</label>
       </deck>
       <spacer flex="1"/>
     </vbox>
   </deck>
 </dialog>
+</window>
--- a/mailnews/base/search/content/CustomHeaders.js
+++ b/mailnews/base/search/content/CustomHeaders.js
@@ -176,17 +176,19 @@ function addRow(newHdr) {
 
 function updateAddButton(aDisable) {
   // only update the button if the disabled state changed
   if (aDisable == gAddButton.disabled) {
     return;
   }
 
   gAddButton.disabled = aDisable;
-  document.documentElement.defaultButton = aDisable ? "accept" : "extra1";
+  document.querySelector("dialog").defaultButton = aDisable
+    ? "accept"
+    : "extra1";
 }
 
 function updateRemoveButton() {
   var headerSelected = gHdrsList.selectedItems.length > 0;
   gRemoveButton.disabled = !headerSelected;
   if (gRemoveButton.disabled) {
     gHeaderInputElement.focus();
   }
--- a/mailnews/base/search/content/CustomHeaders.xul
+++ b/mailnews/base/search/content/CustomHeaders.xul
@@ -4,26 +4,25 @@
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 #ifdef MOZ_THUNDERBIRD
 <?xml-stylesheet href="chrome://messenger/skin/" type="text/css"?>
 #else
 <?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
 #endif
 <?xml-stylesheet type="text/css" href="chrome://messenger/skin/input-fields.css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/CustomHeaders.dtd">
-<dialog id="customHeadersDialog"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/CustomHeaders.dtd">
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         onload="onLoad();"
         style="width: 30em; height: 25em;"
         persist="width height screenX screenY"
-        title="&window.title;"
+        title="&window.title;">
+<dialog id="customHeadersDialog"
         buttons="accept,cancel,extra1,extra2">
-
   <stringbundle id="bundle_filter" src="chrome://messenger/locale/filter.properties"/>
   <stringbundle id="bundle_custom" src="chrome://messenger/locale/custom.properties"/>
 
   <script src="chrome://global/content/globalOverlay.js"/>
   <script src="chrome://global/content/editMenuOverlay.js"/>
   <script src="chrome://messenger/content/CustomHeaders.js"/>
 
   <hbox flex="1">
@@ -50,8 +49,9 @@
               dlgtype="extra1"/>
       <button id="removeButton"
               label="&removeButton.label;"
               accesskey="&removeButton.accesskey;"
               dlgtype="extra2"/>
     </vbox>
   </hbox>
 </dialog>
+</window>
--- a/mailnews/base/search/content/FilterEditor.xul
+++ b/mailnews/base/search/content/FilterEditor.xul
@@ -3,33 +3,32 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/filterDialog.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/folderPane.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/folderMenus.css" type="text/css"?>
 <?xml-stylesheet type="text/css" href="chrome://messenger/skin/input-fields.css"?>
 
-<!DOCTYPE dialog [
+<!DOCTYPE window [
   <!ENTITY % filterEditorDTD SYSTEM "chrome://messenger/locale/FilterEditor.dtd">
   %filterEditorDTD;
   <!ENTITY % searchTermDTD SYSTEM "chrome://messenger/locale/searchTermOverlay.dtd">
   %searchTermDTD;
 ]>
 
-<dialog id="FilterEditor"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="&window.title;"
         style="&filterEditorDialog.dimensions;"
         windowtype="mailnews:filtereditor"
         persist="width height screenX screenY"
-        buttons="accept,cancel"
         onload="filterEditorOnLoad();">
-
+<dialog id="FilterEditor"
+        buttons="accept,cancel">
   <stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
   <stringbundle id="bundle_filter" src="chrome://messenger/locale/filter.properties"/>
   <stringbundle id="bundle_search" src="chrome://messenger/locale/search.properties"/>
 
   <script src="chrome://global/content/globalOverlay.js"/>
   <script src="chrome://global/content/editMenuOverlay.js"/>
   <script src="chrome://messenger/content/searchWidgets.js"/>
   <script src="chrome://messenger/content/mailWindowOverlay.js"/>
@@ -131,8 +130,9 @@
       <label>
         &filterActionOrderWarning.label;
       </label>
       <label id="seeExecutionOrder" class="text-link"
              onclick="showActionsOrder();">&filterActionOrder.label;</label>
     </hbox>
   </vbox>
 </dialog>
+</window>
--- a/mailnews/base/search/content/viewLog.xul
+++ b/mailnews/base/search/content/viewLog.xul
@@ -1,29 +1,28 @@
 <?xml version="1.0"?>
 
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/viewLog.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/viewLog.dtd">
 
-<dialog id="viewLogWindow"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
         onload="onLoad();"
         title="&viewLog.title;"
         windowtype="mailnews:filterlog"
+        persist="screenX screenY width height"
+        style="width: 40em; height: 25em;">
+<dialog id="viewLogWindow"
         buttons="accept"
         buttonlabelaccept="&closeLog.label;"
-        buttonaccesskeyaccept="&closeLog.accesskey;"
-        persist="screenX screenY width height"
-        style="width: 40em; height: 25em;">
-
+        buttonaccesskeyaccept="&closeLog.accesskey;">
   <script src="chrome://messenger/content/viewLog.js"/>
 
   <vbox flex="1">
     <description>&viewLogInfo.text;</description>
     <hbox>
       <checkbox id="logFilters"
                 label="&enableLog.label;"
                 accesskey="&enableLog.accesskey;"
@@ -41,8 +40,9 @@
                disablehistory="true"
                disablesecurity="true"
                src="about:blank"
                autofind="false"
                flex="1"/>
     </hbox>
   </vbox>
 </dialog>
+</window>
--- a/mailnews/compose/content/askSendFormat.xul
+++ b/mailnews/compose/content/askSendFormat.xul
@@ -1,27 +1,26 @@
 <?xml version="1.0"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/messengercompose/askSendFormat.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/messengercompose/askSendFormat.dtd">
 
-<dialog id="askSendFormat"
-        title="&windowTitle.label;"
+<window title="&windowTitle.label;"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
+        onload="Startup();"
+        style="width: 75ch; height: 20em;">
+<dialog id="askSendFormat"
         buttonpack="center"
-        onload="Startup();"
         buttonlabelaccept="&send.label;"
-        buttonaccesskeyaccept="&send.accesskey;"
-        style="width: 75ch; height: 20em;">
-
+        buttonaccesskeyaccept="&send.accesskey;">
   <script src="chrome://messenger/content/messengercompose/askSendFormat.js"/>
 
   <stringbundle id="askSendFormatStringBundle"
                 src="chrome://messenger/locale/messengercompose/askSendFormat.properties"/>
 
     <hbox flex="1">
       <separator orient="vertical"/>
       <vbox id="askImageBox">
@@ -37,8 +36,9 @@
           <radio value="3" label="&plainTextAndHtml.label;" accesskey="&plainTextAndHtml.accesskey;"/>
           <radio value="1" selected="true"
                  label="&plainTextOnly.label;" accesskey="&plainTextOnly.accesskey;"/>
           <radio value="2" label="&htmlOnly.label;" accesskey="&htmlOnly.accesskey;"/>
         </radiogroup>
       </vbox>
     </hbox>
 </dialog>
+</window>
--- a/mailnews/compose/content/sendProgress.xul
+++ b/mailnews/compose/content/sendProgress.xul
@@ -1,27 +1,26 @@
 <?xml version="1.0"?>
 
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/messengercompose/sendProgress.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/messengercompose/sendProgress.dtd">
 
-<dialog id="sendProgress"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="&sendDialog.title;"
         style="width: 56ch;"
         onload="onLoad();"
-        onunload="onUnload();"
+        onunload="onUnload();">
+<dialog id="sendProgress"
         buttons="cancel">
-
   <script src="chrome://messenger/content/messengercompose/sendProgress.js"/>
   <stringbundle id="sendProgressStringBundle"
                 src="chrome://messenger/locale/messengercompose/sendProgress.properties"/>
 
     <hbox flex="1">
       <vbox align="end">
         <hbox flex="1" align="center">
           <label value="&status.label;"/>
@@ -35,10 +34,10 @@
           <label id="dialog.status" crop="center"/>
         </hbox>
         <hbox class="thin-separator" flex="1" align="center" style="display:flex; align-items:stretch;">
           <html:progress id="dialog.progress" value="0" max="100" style="flex:1;"/>
           <label id="dialog.progressText" value=""/>
         </hbox>
       </vbox>
     </hbox>
-
 </dialog>
+</window>
--- a/mailnews/extensions/smime/content/certFetchingStatus.xul
+++ b/mailnews/extensions/smime/content/certFetchingStatus.xul
@@ -1,23 +1,23 @@
 <?xml version="1.0"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/smime/certFetchingStatus.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger-smime/locale/certFetchingStatus.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger-smime/locale/certFetchingStatus.dtd">
 
-<dialog id="certFetchingStatus" title="&title.label;"
-  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
-  style="width: 50em;"
-  buttons="cancel"
-  buttonlabelcancel="&stop.label;"
-  onload="onLoad();">
-
+<window title="&title.label;"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
+        style="width: 50em;"
+        onload="onLoad();">
+<dialog id="certFetchingStatus"
+        buttons="cancel"
+        buttonlabelcancel="&stop.label;">
   <stringbundle id="bundle_ldap" src="chrome://mozldap/locale/ldap.properties"/>
-<script src="chrome://messenger-smime/content/certFetchingStatus.js"/>
+  <script src="chrome://messenger-smime/content/certFetchingStatus.js"/>
 
   <description>&info.message;</description>
-
 </dialog>
+</window>
--- a/mailnews/extensions/smime/content/certpicker.xul
+++ b/mailnews/extensions/smime/content/certpicker.xul
@@ -1,27 +1,27 @@
 <?xml version="1.0"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
 
-<!DOCTYPE dialog [
+<!DOCTYPE window [
 <!ENTITY % amSMIMEDTD SYSTEM "chrome://messenger/locale/am-smime.dtd" >
 %amSMIMEDTD;
 ]>
 
-<dialog id="certPicker" title="&certPicker.title;"
-  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-  xmlns:html="http://www.w3.org/1999/xhtml"
-  style="width: 50em;"
-  buttons="accept,cancel"
-  onload="onLoad();">
-
+<window title="&certPicker.title;"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        xmlns:html="http://www.w3.org/1999/xhtml"
+        style="width: 50em;"
+        onload="onLoad();">
+<dialog id="certPicker"
+        buttons="accept,cancel">
 <script src="chrome://global/content/globalOverlay.js"/>
 <script src="chrome://global/content/editMenuOverlay.js"/>
 <script src="chrome://messenger/content/certpicker.js"/>
 
   <hbox align="center">
     <label id="pickerInfo" value="&certPicker.info;"/>
     <!-- The items in this menulist must never be sorted,
          but remain in the order filled by the application
@@ -29,8 +29,9 @@
     <menulist id="nicknames" oncommand="onCertSelected();">
       <menupopup/>
     </menulist>
   </hbox>
   <separator class="thin"/>
   <label value="&certPicker.detailsLabel;"/>
   <html:textarea id="details" readonly="readonly" style="height: 12em;" flex="1"/>
 </dialog>
+</window>
--- a/mailnews/extensions/smime/content/msgCompSecurityInfo.xul
+++ b/mailnews/extensions/smime/content/msgCompSecurityInfo.xul
@@ -1,25 +1,25 @@
 <?xml version="1.0"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/smime/msgCompSecurityInfo.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger-smime/locale/msgCompSecurityInfo.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger-smime/locale/msgCompSecurityInfo.dtd">
 
-<dialog id="msgCompSecurityInfo" title="&title.label;"
-  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
-  style="width: 50em;"
-  persist="width height"
-  buttons="accept"
-  onload="onLoad();">
-
+<window title="&title.label;"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
+        style="width: 50em;"
+        persist="width height"
+        onload="onLoad();">
+<dialog id="msgCompSecurityInfo"
+        buttons="accept">
   <script src="chrome://messenger-smime/content/msgCompSecurityInfo.js"/>
   <script><![CDATA[
       function resizeColumns() {
         let list = document.getElementById("infolist");
         let cols = list.getElementsByTagName("treecol");
         list.style.setProperty("--recipientWidth", cols[0].getBoundingClientRect().width + "px");
         list.style.setProperty("--statusWidth", cols[1].getBoundingClientRect().width + "px");
         list.style.setProperty("--issuedWidth", cols[2].getBoundingClientRect().width + "px");
@@ -60,8 +60,9 @@
     </treecols>
   </richlistbox>
   <hbox pack="start">
     <button id="viewCertButton" disabled="true"
             label="&view.label;" accesskey="&view.accesskey;"
             oncommand="viewSelectedCert();"/>
   </hbox>
 </dialog>
+</window>
--- a/mailnews/extensions/smime/content/msgReadSecurityInfo.xul
+++ b/mailnews/extensions/smime/content/msgReadSecurityInfo.xul
@@ -1,24 +1,24 @@
 <?xml version="1.0"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/skin/smime/msgReadSecurityInfo.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger-smime/locale/msgReadSecurityInfo.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger-smime/locale/msgReadSecurityInfo.dtd">
 
-<dialog id="msgReadSecurityInfo" title="&status.label;"
-  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
-  style="width: 40em;"
-  buttons="accept"
-  onload="onLoad();">
-
+<window title="&status.label;"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
+        style="width: 40em;"
+        onload="onLoad();">
+<dialog id="msgReadSecurityInfo"
+        buttons="accept">
   <script src="chrome://messenger-smime/content/msgReadSecurityInfo.js"/>
 
   <stringbundle id="bundle_smime_read_info" src="chrome://messenger-smime/locale/msgSecurityInfo.properties"/>
 
   <vbox flex="1">
     <label id="signatureLabel"/>
     <label id="signatureHeader" collapsed="true"/>
     <description id="signatureExplanation"/>
@@ -61,8 +61,9 @@
       </hbox>
       <hbox>
         <button id="encryptionCertView" label="&encryptionCert.label;"
                 oncommand="viewEncryptionCert()"/>
       </hbox>
     </vbox>
   </vbox>
 </dialog>
+</window>
--- a/mailnews/import/content/fieldMapImport.xul
+++ b/mailnews/import/content/fieldMapImport.xul
@@ -5,24 +5,23 @@
 #ifdef MOZ_THUNDERBIRD
 <?xml-stylesheet href="chrome://messenger/skin/" type="text/css"?>
 #else
 <?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
 #endif
 <?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
 <?xml-stylesheet href="chrome://messenger/content/fieldMapImport.css" type="text/css"?>
 
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/fieldMapImport.dtd">
+<!DOCTYPE window SYSTEM "chrome://messenger/locale/fieldMapImport.dtd">
 
-<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
-        buttons="accept,cancel"
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
         title="&fieldMapImport.title;"
         style="&fieldMapImport.size;"
         onload="OnLoadFieldMapImport();">
-
+<dialog buttons="accept,cancel">
   <script src="chrome://messenger/content/fieldMapImport.js"/>
   <script><![CDATA[
       function resizeColumns() {
         let list = document.getElementById("fieldList");
         let cols = list.getElementsByTagName("treecol");
         list.style.setProperty("--column1width", cols[0].getBoundingClientRect().width + "px");
         list.style.setProperty("--column2width", cols[1].getBoundingClientRect().width + "px");
       }
@@ -71,10 +70,10 @@
               accesskey="&fieldMapImport.up.accesskey;"
               oncommand="moveItem(true);"/>
       <button id="downButton" class="down" label="&fieldMapImport.down.label;"
               accesskey="&fieldMapImport.down.accesskey;"
               oncommand="moveItem(false);"/>
       <spacer flex="1"/>
     </vbox>
   </hbox>
-
 </dialog>
+</window>
--- a/mailnews/news/content/downloadheaders.js
+++ b/mailnews/news/content/downloadheaders.js
@@ -32,17 +32,17 @@ function OnLoad() {
 
     document.title = newsBundle.getString("downloadHeadersTitlePrefix");
 
     let infotext = newsBundle.getFormattedString("downloadHeadersInfoText", [
       args.articleCount,
     ]);
     setText("info", infotext);
     let okButtonText = newsBundle.getString("okButtonText");
-    let okbutton = document.documentElement.getButton("accept");
+    let okbutton = document.querySelector("dialog").getButton("accept");
     okbutton.setAttribute("label", okButtonText);
     okbutton.focus();
     setText("newsgroupLabel", args.groupName);
   }
 
   numberElement = document.getElementById("number");
   numberElement.value = nntpServer.maxArticles;