Bug 1616179 - Assign an id to the <window> for the sanitize dialog to fix location persistence;r=Gijs
authorBrian Grinstead <bgrinstead@mozilla.com>
Tue, 18 Feb 2020 23:29:04 +0000
changeset 514536 844430d0d7513a459116ea068abbb6f466d666f8
parent 514535 5ea05e514940c783dc4fe8b0ba9cc2003d06cc20
child 514537 6e8ad5bbe739461c13c3b240ae2876a606d41a92
push id37136
push useropoprus@mozilla.com
push dateWed, 19 Feb 2020 04:34:03 +0000
treeherdermozilla-central@28cf163158a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1616179
milestone75.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1616179 - Assign an id to the <window> for the sanitize dialog to fix location persistence;r=Gijs The [persist] attribute requires the element has an id, so it was failing to remember screenX and screenY for the dialog before this change. Depends on D63233 Differential Revision: https://phabricator.services.mozilla.com/D63236
browser/base/content/sanitize.xhtml
browser/base/content/sanitizeDialog.js
browser/base/content/test/sanitize/browser_sanitizeDialog.js
browser/components/preferences/sanitize.js
browser/components/preferences/sanitize.xhtml
--- a/browser/base/content/sanitize.xhtml
+++ b/browser/base/content/sanitize.xhtml
@@ -9,25 +9,25 @@
 <?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
 <?xml-stylesheet href="chrome://browser/skin/sanitizeDialog.css"?>
 
 
 <?xml-stylesheet href="chrome://browser/content/sanitizeDialog.css"?>
 
 <!DOCTYPE window>
 
-<window type="child"
+<window id="SanitizeDialog"
+        type="child"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         persist="lastSelected screenX screenY"
         data-l10n-id="dialog-title"
         data-l10n-attrs="style"
         onload="gSanitizePromptDialog.init();">
-<dialog id="SanitizeDialog"
-        buttons="accept,cancel">
+<dialog buttons="accept,cancel">
 
   <linkset>
     <html:link rel="localization" href="browser/sanitize.ftl"/>
   </linkset>
 
   <script src="chrome://global/content/preferencesBindings.js"/>
   <script src="chrome://browser/content/sanitizeDialog.js"/>
 
--- a/browser/base/content/sanitizeDialog.js
+++ b/browser/base/content/sanitizeDialog.js
@@ -28,17 +28,17 @@ var gSanitizePromptDialog = {
 
   get warningBox() {
     return document.getElementById("sanitizeEverythingWarningBox");
   },
 
   init() {
     // This is used by selectByTimespan() to determine if the window has loaded.
     this._inited = true;
-    this._dialog = document.getElementById("SanitizeDialog");
+    this._dialog = document.querySelector("dialog");
 
     let OKButton = this._dialog.getButton("accept");
     document.l10n.setAttributes(OKButton, "sanitize-button-ok");
 
     document.addEventListener("dialogaccept", function(e) {
       gSanitizePromptDialog.sanitize(e);
     });
 
--- a/browser/base/content/test/sanitize/browser_sanitizeDialog.js
+++ b/browser/base/content/test/sanitize/browser_sanitizeDialog.js
@@ -622,30 +622,30 @@ function WindowHelper(aWin) {
   });
 }
 
 WindowHelper.prototype = {
   /**
    * "Presses" the dialog's OK button.
    */
   acceptDialog() {
-    let dialog = this.win.document.getElementById("SanitizeDialog");
+    let dialog = this.win.document.querySelector("dialog");
     is(
       dialog.getButton("accept").disabled,
       false,
       "Dialog's OK button should not be disabled"
     );
     dialog.acceptDialog();
   },
 
   /**
    * "Presses" the dialog's Cancel button.
    */
   cancelDialog() {
-    this.win.document.getElementById("SanitizeDialog").cancelDialog();
+    this.win.document.querySelector("dialog").cancelDialog();
   },
 
   /**
    * (Un)checks a history scope checkbox (browser & download history,
    * form history, etc.).
    *
    * @param aPrefName
    *        The final portion of the checkbox's privacy.cpd.* preference name
--- a/browser/components/preferences/sanitize.js
+++ b/browser/components/preferences/sanitize.js
@@ -1,17 +1,17 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 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/. */
 
 /* import-globals-from ../../../toolkit/content/preferencesBindings.js */
 
 document
-  .getElementById("SanitizeDialog")
+  .querySelector("dialog")
   .addEventListener("dialoghelp", window.top.openPrefsHelp);
 
 Preferences.addAll([
   { id: "privacy.clearOnShutdown.history", type: "bool" },
   { id: "privacy.clearOnShutdown.formdata", type: "bool" },
   { id: "privacy.clearOnShutdown.downloads", type: "bool" },
   { id: "privacy.clearOnShutdown.cookies", type: "bool" },
   { id: "privacy.clearOnShutdown.cache", type: "bool" },
--- a/browser/components/preferences/sanitize.xhtml
+++ b/browser/components/preferences/sanitize.xhtml
@@ -5,25 +5,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://global/skin/"?>
 <?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
 
 <!DOCTYPE window>
 
-<window type="child"
+<window id="SanitizeDialog"
+        type="child"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         persist="lastSelected screenX screenY"
         data-l10n-id="sanitize-prefs"
         data-l10n-attrs="style"
         onload="gSanitizeDialog.init();">
-<dialog id="SanitizeDialog"
-        buttons="accept,cancel,help"
+<dialog buttons="accept,cancel,help"
         helpTopic="prefs-clear-private-data">
 
   <linkset>
     <html:link rel="localization" href="browser/sanitize.ftl"/>
     <html:link rel="localization" href="branding/brand.ftl"/>
   </linkset>
 
   <script src="chrome://browser/content/utilityOverlay.js"/>