Bug 795556 - Part 2: Move privacy status propagation for new windows into the platform. r=bz
This commit is contained in:
@@ -2793,24 +2793,26 @@ nsDocShell::SetDocLoaderParent(nsDocLoader * aParent)
|
||||
}
|
||||
SetAllowDNSPrefetch(value);
|
||||
}
|
||||
#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
|
||||
// Set the PB flag on the docshell based on the global PB mode for now
|
||||
nsCOMPtr<nsIPrivateBrowsingService> pbs =
|
||||
do_GetService(NS_PRIVATE_BROWSING_SERVICE_CONTRACTID);
|
||||
if (pbs) {
|
||||
bool inPrivateBrowsing = false;
|
||||
pbs->GetPrivateBrowsingEnabled(&inPrivateBrowsing);
|
||||
SetUsePrivateBrowsing(inPrivateBrowsing);
|
||||
}
|
||||
#else
|
||||
|
||||
nsCOMPtr<nsILoadContext> parentAsLoadContext(do_QueryInterface(parent));
|
||||
if (parentAsLoadContext &&
|
||||
NS_SUCCEEDED(parentAsLoadContext->GetUsePrivateBrowsing(&value)))
|
||||
{
|
||||
SetUsePrivateBrowsing(value);
|
||||
}
|
||||
#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
|
||||
// Belt and suspenders - we want to catch any instances where the flag
|
||||
// we're propagating doesn't match the global state.
|
||||
nsCOMPtr<nsIPrivateBrowsingService> pbs =
|
||||
do_GetService(NS_PRIVATE_BROWSING_SERVICE_CONTRACTID);
|
||||
if (pbs) {
|
||||
bool inPrivateBrowsing = false;
|
||||
pbs->GetPrivateBrowsingEnabled(&inPrivateBrowsing);
|
||||
NS_ASSERTION(inPrivateBrowsing == mInPrivateBrowsing,
|
||||
"Privacy status of parent docshell doesn't match global state!");
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURIContentListener> parentURIListener(do_GetInterface(parent));
|
||||
if (parentURIListener)
|
||||
mContentListener->SetParentContentListener(parentURIListener);
|
||||
|
||||
Reference in New Issue
Block a user