Bug 973658 - Actually revert the value of the Permanent Private Browsing pref when the user presses Cancel in response to the restart dialog; r=jdm
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 18 Feb 2014 08:49:39 -0500
changeset 169339 158d923965d33df79a7257a1a669dd6c44b75c5f
parent 169338 eed4ef04aa7647fd00d1d08fb36fa3812affb5e1
child 169340 88695c24eaf46dfce6a2c096b1ff0649cb11f302
push id26245
push userryanvm@gmail.com
push dateTue, 18 Feb 2014 20:18:17 +0000
treeherdermozilla-central@9019cc90719c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs973658
milestone30.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 973658 - Actually revert the value of the Permanent Private Browsing pref when the user presses Cancel in response to the restart dialog; r=jdm Before we were implicitly relying on the pref being reverted through the checkbox, but that won't happen if the checkbox was never clicked by the user.
browser/components/preferences/in-content/privacy.js
browser/components/preferences/privacy.js
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -242,17 +242,17 @@ var gPrivacyPane = {
   {
     let mode = document.getElementById("historyMode");
     let autoStart = document.getElementById("privateBrowsingAutoStart");
     this._lastMode = mode.selectedIndex;
     this._lastCheckState = autoStart.hasAttribute('checked');
   },
 
   _lastMode: null,
-  _lasCheckState: null,
+  _lastCheckState: null,
   updateAutostart: function PPP_updateAutostart() {
       let mode = document.getElementById("historyMode");
       let autoStart = document.getElementById("privateBrowsingAutoStart");
       let pref = document.getElementById("browser.privatebrowsing.autostart");
       if ((mode.value == "custom" && this._lastCheckState == autoStart.checked) ||
           (mode.value == "remember" && !this._lastCheckState) ||
           (mode.value == "dontremember" && this._lastCheckState)) {
           // These are all no-op changes, so we don't need to prompt.
@@ -294,16 +294,17 @@ var gPrivacyPane = {
 
       this._shouldPromptForRestart = false;
 
       if (this._lastCheckState) {
         autoStart.checked = "checked";
       } else {
         autoStart.removeAttribute('checked');
       }
+      pref.value = autoStart.hasAttribute('checked');
       mode.selectedIndex = this._lastMode;
       mode.doCommand();
 
       this._shouldPromptForRestart = true;
   },
 
   // HISTORY
 
--- a/browser/components/preferences/privacy.js
+++ b/browser/components/preferences/privacy.js
@@ -244,17 +244,17 @@ var gPrivacyPane = {
   {
     let mode = document.getElementById("historyMode");
     let autoStart = document.getElementById("privateBrowsingAutoStart");
     this._lastMode = mode.selectedIndex;
     this._lastCheckState = autoStart.hasAttribute('checked');
   },
 
   _lastMode: null,
-  _lasCheckState: null,
+  _lastCheckState: null,
   updateAutostart: function PPP_updateAutostart() {
       let mode = document.getElementById("historyMode");
       let autoStart = document.getElementById("privateBrowsingAutoStart");
       let pref = document.getElementById("browser.privatebrowsing.autostart");
       if ((mode.value == "custom" && this._lastCheckState == autoStart.checked) ||
           (mode.value == "remember" && !this._lastCheckState) ||
           (mode.value == "dontremember" && this._lastCheckState)) {
           // These are all no-op changes, so we don't need to prompt.
@@ -296,16 +296,17 @@ var gPrivacyPane = {
 
       this._shouldPromptForRestart = false;
 
       if (this._lastCheckState) {
         autoStart.checked = "checked";
       } else {
         autoStart.removeAttribute('checked');
       }
+      pref.value = autoStart.hasAttribute('checked');
       mode.selectedIndex = this._lastMode;
       mode.doCommand();
 
       this._shouldPromptForRestart = true;
   },
 
   // HISTORY