Bug 729204 - Make docshell privacy notifications work across multiple processes. r=bz
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#ifdef MOZ_LOGGING
|
||||
@@ -714,6 +715,19 @@ ConvertLoadTypeToNavigationType(PRUint32 aLoadType)
|
||||
|
||||
static nsISHEntry* GetRootSHEntry(nsISHEntry *entry);
|
||||
|
||||
static void
|
||||
IncreasePrivateDocShellCount()
|
||||
{
|
||||
gNumberOfPrivateDocShells++;
|
||||
if (gNumberOfPrivateDocShells > 1 ||
|
||||
XRE_GetProcessType() != GeckoProcessType_Content) {
|
||||
return;
|
||||
}
|
||||
|
||||
mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton();
|
||||
cc->SendPrivateDocShellsExist(true);
|
||||
}
|
||||
|
||||
static void
|
||||
DecreasePrivateDocShellCount()
|
||||
{
|
||||
@@ -721,9 +735,16 @@ DecreasePrivateDocShellCount()
|
||||
gNumberOfPrivateDocShells--;
|
||||
if (!gNumberOfPrivateDocShells)
|
||||
{
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton();
|
||||
cc->SendPrivateDocShellsExist(false);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIObserverService> obsvc = mozilla::services::GetObserverService();
|
||||
if (obsvc)
|
||||
if (obsvc) {
|
||||
obsvc->NotifyObservers(nsnull, "last-pb-context-exited", nsnull);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2023,7 +2044,7 @@ nsDocShell::SetUsePrivateBrowsing(bool aUsePrivateBrowsing)
|
||||
if (aUsePrivateBrowsing != mInPrivateBrowsing) {
|
||||
mInPrivateBrowsing = aUsePrivateBrowsing;
|
||||
if (aUsePrivateBrowsing) {
|
||||
gNumberOfPrivateDocShells++;
|
||||
IncreasePrivateDocShellCount();
|
||||
} else {
|
||||
DecreasePrivateDocShellCount();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user