Bug 729261 - Set private browsing attribute on windows that exist after transition into PB mode. r=ehsan
authorJosh Matthews <josh@joshmatthews.net>
Tue, 21 Feb 2012 16:01:05 -0500
changeset 87730 15461fddfe455656a16f69c3df65fac07ede4777
parent 87729 89fbc0fd6006c135d8cd003f72ba50dfad45bdfb
child 87731 4facf0c60bddc6d4c4e1cd1eeb76db7bd0bc76aa
push id22143
push userphilringnalda@gmail.com
push dateSun, 26 Feb 2012 23:12:35 +0000
treeherdermozilla-central@b98fc24ac54b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs729261
milestone13.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 729261 - Set private browsing attribute on windows that exist after transition into PB mode. r=ehsan
browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
--- a/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
+++ b/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
@@ -184,28 +184,16 @@ PrivateBrowsingService.prototype = {
           let plainURL = win.gBrowser.currentURI.spec;
           if (plainURL.indexOf("view-source:") == 0) {
             plainURL = plainURL.substr(12);
             this._viewSrcURLs.push(plainURL);
           }
         }
         win.close();
       }
-        
-      var windowsEnum = Services.wm.getEnumerator("navigator:browser");
-      while (windowsEnum.hasMoreElements()) {
-        var window = windowsEnum.getNext();
-        window.getInterface(Ci.nsIWebNavigation)
-              .QueryInterface(Ci.nsIDocShellTreeItem)
-              .treeOwner
-              .QueryInterface(Ci.nsIInterfaceRequestor)
-              .getInterface(Ci.nsIXULWindow)
-              .docShell.QueryInterface(Ci.nsILoadContext)
-              .usePrivateBrowsing = this._inPrivateBrowsing;
-      }
 
       if (!this._quitting && this._saveSession) {
         let browserWindow = this._getBrowserWindow();
 
 	// if there are open browser windows, load a dummy session to get a distinct 
         // separation between private and non-private sessions
 	if (browserWindow) {
           // set an empty session to transition from/to pb mode, see bug 476463
@@ -224,16 +212,28 @@ PrivateBrowsingService.prototype = {
           browser.removeTab(browser.tabContainer.firstChild);
           browserWindow.getInterface(Ci.nsIWebNavigation)
                        .QueryInterface(Ci.nsIDocShellTreeItem)
                        .treeOwner
                        .QueryInterface(Ci.nsIInterfaceRequestor)
                        .getInterface(Ci.nsIXULWindow)
                        .docShell.contentViewer.resetCloseWindow();
         }
+
+        var windowsEnum = Services.wm.getEnumerator("navigator:browser");
+        while (windowsEnum.hasMoreElements()) {
+          var window = windowsEnum.getNext();
+          window.getInterface(Ci.nsIWebNavigation)
+                .QueryInterface(Ci.nsIDocShellTreeItem)
+                .treeOwner
+                .QueryInterface(Ci.nsIInterfaceRequestor)
+                .getInterface(Ci.nsIXULWindow)
+                .docShell.QueryInterface(Ci.nsILoadContext)
+                .usePrivateBrowsing = this._inPrivateBrowsing;
+        }
       }
     }
     else
       this._saveSession = false;
   },
 
   _onAfterPrivateBrowsingModeChange: function PBS__onAfterPrivateBrowsingModeChange() {
     // nothing to do here if we're enabling at startup or the current session is being