зеркало из https://github.com/mozilla/pjs.git
Bug 725210 - Add observer notification for last PB docshell going away. r=bz
This commit is contained in:
Родитель
2521fe669d
Коммит
70fb079c8e
|
@ -242,6 +242,9 @@ static PRInt32 gNumberOfDocumentsLoading = 0;
|
||||||
// Global count of existing docshells.
|
// Global count of existing docshells.
|
||||||
static PRInt32 gDocShellCount = 0;
|
static PRInt32 gDocShellCount = 0;
|
||||||
|
|
||||||
|
// Global count of docshells with the private attribute set
|
||||||
|
static PRUint32 gNumberOfPrivateDocShells = 0;
|
||||||
|
|
||||||
// Global reference to the URI fixup service.
|
// Global reference to the URI fixup service.
|
||||||
nsIURIFixup *nsDocShell::sURIFixup = 0;
|
nsIURIFixup *nsDocShell::sURIFixup = 0;
|
||||||
|
|
||||||
|
@ -710,6 +713,19 @@ ConvertLoadTypeToNavigationType(PRUint32 aLoadType)
|
||||||
|
|
||||||
static nsISHEntry* GetRootSHEntry(nsISHEntry *entry);
|
static nsISHEntry* GetRootSHEntry(nsISHEntry *entry);
|
||||||
|
|
||||||
|
static void
|
||||||
|
DecreasePrivateDocShellCount()
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(gNumberOfPrivateDocShells > 0);
|
||||||
|
gNumberOfPrivateDocShells--;
|
||||||
|
if (!gNumberOfPrivateDocShells)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIObserverService> obsvc = mozilla::services::GetObserverService();
|
||||||
|
if (obsvc)
|
||||||
|
obsvc->NotifyObservers(nsnull, "last-pb-context-exited", nsnull);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//*** nsDocShell: Object Management
|
//*** nsDocShell: Object Management
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
@ -816,6 +832,10 @@ nsDocShell::~nsDocShell()
|
||||||
printf("--DOCSHELL %p == %ld\n", (void*) this, gNumberOfDocShells);
|
printf("--DOCSHELL %p == %ld\n", (void*) this, gNumberOfDocShells);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (mInPrivateBrowsing) {
|
||||||
|
DecreasePrivateDocShellCount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -1998,6 +2018,11 @@ NS_IMETHODIMP
|
||||||
nsDocShell::SetUsePrivateBrowsing(bool aUsePrivateBrowsing)
|
nsDocShell::SetUsePrivateBrowsing(bool aUsePrivateBrowsing)
|
||||||
{
|
{
|
||||||
mInPrivateBrowsing = aUsePrivateBrowsing;
|
mInPrivateBrowsing = aUsePrivateBrowsing;
|
||||||
|
if (aUsePrivateBrowsing) {
|
||||||
|
gNumberOfPrivateDocShells++;
|
||||||
|
} else {
|
||||||
|
DecreasePrivateDocShellCount();
|
||||||
|
}
|
||||||
|
|
||||||
PRInt32 count = mChildList.Count();
|
PRInt32 count = mChildList.Count();
|
||||||
for (PRInt32 i = 0; i < count; ++i) {
|
for (PRInt32 i = 0; i < count; ++i) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче