Bug 804653 - Make destroying a private docshell update the global count of private docshells instead of waiting an indefinite amount of time for the destructor. r=bz a=akeybl
authorJosh Matthews <josh@joshmatthews.net>
Tue, 30 Oct 2012 09:21:52 -0400
changeset 113907 573627e62736389681a5421ee9f6f50da465dc1f
parent 113906 aee404ebbdae2215f1f3eff0383aaeb0cd1fb937
child 113908 bdc684adc57bfadee6e733d1bedc5c034e92a5cd
push id2562
push usereakhgari@mozilla.com
push dateFri, 02 Nov 2012 22:48:16 +0000
treeherdermozilla-aurora@573627e62736 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, akeybl
bugs804653
milestone18.0a2
Bug 804653 - Make destroying a private docshell update the global count of private docshells instead of waiting an indefinite amount of time for the destructor. r=bz a=akeybl
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -820,20 +820,16 @@ nsDocShell::~nsDocShell()
 #ifdef DEBUG
     // We're counting the number of |nsDocShells| to help find leaks
     --gNumberOfDocShells;
     if (!PR_GetEnv("MOZ_QUIET")) {
         printf("--DOCSHELL %p == %ld [id = %llu]\n", (void*) this,
                gNumberOfDocShells, mHistoryID);
     }
 #endif
-
-    if (mInPrivateBrowsing) {
-        DecreasePrivateDocShellCount();
-    }
 }
 
 nsresult
 nsDocShell::Init()
 {
     nsresult rv = nsDocLoader::Init();
     NS_ENSURE_SUCCESS(rv, rv);
 
@@ -4917,16 +4913,22 @@ nsDocShell::Destroy()
     SetTreeOwner(nullptr);
 
     // required to break ref cycle
     mSecurityUI = nullptr;
 
     // Cancel any timers that were set for this docshell; this is needed
     // to break the cycle between us and the timers.
     CancelRefreshURITimers();
+
+    if (mInPrivateBrowsing) {
+        mInPrivateBrowsing = false;
+        DecreasePrivateDocShellCount();
+    }
+
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShell::SetPosition(int32_t x, int32_t y)
 {
     mBounds.x = x;
     mBounds.y = y;