Bug 847627 - Sanitize on shutdown dialog should visually link download history to history.
authorMarco Bonardo <mbonardo@mozilla.com>
Tue, 19 Mar 2013 18:46:13 +0100
changeset 125450 34bf1e07b8d3ffdade95ea3e457eb7aa3c92e338
parent 125449 b0b858d36b3d589f007b92eee27fba3c95f436bd
child 125451 ab69ab8ffbce926585d7f2bf24bd6feab980c24b
push id24945
push usermak77@bonardo.net
push dateTue, 19 Mar 2013 17:46:28 +0000
treeherdermozilla-inbound@34bf1e07b8d3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs847627
milestone22.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 847627 - Sanitize on shutdown dialog should visually link download history to history. r=gavin
browser/components/preferences/jar.mn
browser/components/preferences/sanitize.js
browser/components/preferences/sanitize.xul
--- a/browser/components/preferences/jar.mn
+++ b/browser/components/preferences/jar.mn
@@ -30,16 +30,17 @@ browser.jar:
 *   content/browser/preferences/main.xul
     content/browser/preferences/main.js
 *   content/browser/preferences/permissions.xul
     content/browser/preferences/permissions.js
 *   content/browser/preferences/preferences.xul
     content/browser/preferences/privacy.xul
     content/browser/preferences/privacy.js
     content/browser/preferences/sanitize.xul
+    content/browser/preferences/sanitize.js
     content/browser/preferences/security.xul
     content/browser/preferences/security.js
     content/browser/preferences/selectBookmark.xul
     content/browser/preferences/selectBookmark.js
 #ifdef MOZ_SERVICES_SYNC
     content/browser/preferences/sync.xul
     content/browser/preferences/sync.js
 #endif
new file mode 100644
--- /dev/null
+++ b/browser/components/preferences/sanitize.js
@@ -0,0 +1,27 @@
+/* -*- Mode: Java; tab-width: 4; 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/. */
+
+XPCOMUtils.defineLazyModuleGetter(this, "DownloadsCommon",
+                                  "resource:///modules/DownloadsCommon.jsm");
+
+let gSanitizeDialog = Object.freeze({
+  /**
+   * Sets up the UI.
+   */
+  init: function ()
+  {
+    let downloadsPref = document.getElementById("privacy.clearOnShutdown.downloads");
+    downloadsPref.disabled = !DownloadsCommon.useToolkitUI;
+    this.onClearHistoryChanged();
+  },
+
+  onClearHistoryChanged: function () {
+    if (DownloadsCommon.useToolkitUI)
+      return;
+    let downloadsPref = document.getElementById("privacy.clearOnShutdown.downloads");
+    let historyPref = document.getElementById("privacy.clearOnShutdown.history");
+    downloadsPref.value = historyPref.value;
+  }
+});
--- a/browser/components/preferences/sanitize.xul
+++ b/browser/components/preferences/sanitize.xul
@@ -15,25 +15,28 @@
   %sanitizeDTD;
 ]>
 
 <prefwindow id="SanitizeDialog" type="child"
             xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
             dlgbuttons="accept,cancel,help"
             ondialoghelp="openPrefsHelp()"
             style="width: &dialog.width;;"
-            title="&sanitizePrefs2.title;">
+            title="&sanitizePrefs2.title;"
+            onload="gSanitizeDialog.init();">
 
   <script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
+  <script type="application/javascript" src="chrome://browser/content/preferences/sanitize.js"/>
 
   <prefpane id="SanitizeDialogPane"
             helpTopic="prefs-clear-private-data">
 
     <preferences>
-      <preference id="privacy.clearOnShutdown.history"               name="privacy.clearOnShutdown.history"               type="bool"/>
+      <preference id="privacy.clearOnShutdown.history"               name="privacy.clearOnShutdown.history"               type="bool"
+                  onchange="return gSanitizeDialog.onClearHistoryChanged();"/>
       <preference id="privacy.clearOnShutdown.formdata"              name="privacy.clearOnShutdown.formdata"              type="bool"/>
       <preference id="privacy.clearOnShutdown.passwords"             name="privacy.clearOnShutdown.passwords"             type="bool"/>
       <preference id="privacy.clearOnShutdown.downloads"             name="privacy.clearOnShutdown.downloads"             type="bool"/>
       <preference id="privacy.clearOnShutdown.cookies"               name="privacy.clearOnShutdown.cookies"               type="bool"/>
       <preference id="privacy.clearOnShutdown.cache"                 name="privacy.clearOnShutdown.cache"                 type="bool"/>
       <preference id="privacy.clearOnShutdown.offlineApps"           name="privacy.clearOnShutdown.offlineApps"           type="bool"/>
       <preference id="privacy.clearOnShutdown.sessions"              name="privacy.clearOnShutdown.sessions"              type="bool"/>
       <preference id="privacy.clearOnShutdown.siteSettings"          name="privacy.clearOnShutdown.siteSettings"          type="bool"/>