Bug 601253 - Ignore -private-toggle on the command line if permanent private browsing is on; r=dolske,gavin a=bsmedberg
authorEhsan Akhgari <ehsan@mozilla.com>
Sat, 02 Oct 2010 12:12:08 -0400
changeset 56861 488177edfe601687eeb371c143601adad1463843
parent 56860 c0dbdafa583c9b0175263a2d2b07193e0aa255e0
child 56862 b40c5634a2ea01a2120d96fb759a67f063861f4a
push id16717
push usereakhgari@mozilla.com
push dateThu, 04 Nov 2010 20:46:44 +0000
treeherdermozilla-central@e2bab1fa602e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske, gavin, bsmedberg
bugs601253
milestone2.0b8pre
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 601253 - Ignore -private-toggle on the command line if permanent private browsing is on; r=dolske,gavin a=bsmedberg
browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
--- a/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
+++ b/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
@@ -464,18 +464,20 @@ PrivateBrowsingService.prototype = {
   },
 
   // nsICommandLineHandler
 
   handle: function PBS_handle(aCmdLine) {
     if (aCmdLine.handleFlag("private", false))
       ; // It has already been handled
     else if (aCmdLine.handleFlag("private-toggle", false)) {
+      if (this._autoStarted) {
+        throw Cr.NS_ERROR_ABORT;
+      }
       this.privateBrowsingEnabled = !this.privateBrowsingEnabled;
-      this._autoStarted = false;
       this._lastChangedByCommandLine = true;
     }
   },
 
   get helpInfo() {
     return "  -private           Enable private browsing mode.\n" +
            "  -private-toggle    Toggle private browsing mode.\n";
   },