зеркало из https://github.com/mozilla/gecko-dev.git
Bug 725210 - Add observer notification for last PB docshell going away. r=bz
This commit is contained in:
Родитель
7c572b6c0b
Коммит
b8cf0c11fa
|
@ -242,6 +242,9 @@ static PRInt32 gNumberOfDocumentsLoading = 0;
|
|||
// Global count of existing docshells.
|
||||
static PRInt32 gDocShellCount = 0;
|
||||
|
||||
// Global count of docshells with the private attribute set
|
||||
static PRUint32 gNumberOfPrivateDocShells = 0;
|
||||
|
||||
// Global reference to the URI fixup service.
|
||||
nsIURIFixup *nsDocShell::sURIFixup = 0;
|
||||
|
||||
|
@ -710,6 +713,19 @@ ConvertLoadTypeToNavigationType(PRUint32 aLoadType)
|
|||
|
||||
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
|
||||
//*****************************************************************************
|
||||
|
@ -818,6 +834,10 @@ nsDocShell::~nsDocShell()
|
|||
gNumberOfDocShells, mHistoryID);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mInPrivateBrowsing) {
|
||||
DecreasePrivateDocShellCount();
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -1999,8 +2019,15 @@ nsDocShell::GetUsePrivateBrowsing(bool* aUsePrivateBrowsing)
|
|||
NS_IMETHODIMP
|
||||
nsDocShell::SetUsePrivateBrowsing(bool aUsePrivateBrowsing)
|
||||
{
|
||||
mInPrivateBrowsing = aUsePrivateBrowsing;
|
||||
|
||||
if (aUsePrivateBrowsing != mInPrivateBrowsing) {
|
||||
mInPrivateBrowsing = aUsePrivateBrowsing;
|
||||
if (aUsePrivateBrowsing) {
|
||||
gNumberOfPrivateDocShells++;
|
||||
} else {
|
||||
DecreasePrivateDocShellCount();
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32 count = mChildList.Count();
|
||||
for (PRInt32 i = 0; i < count; ++i) {
|
||||
nsCOMPtr<nsILoadContext> shell = do_QueryInterface(ChildAt(i));
|
||||
|
|
Загрузка…
Ссылка в новой задаче