Bug 802885 - Disable offline cache entries for private channels under e10s r=jdm

This commit is contained in:
Jason Duell
2012-10-17 22:00:16 -07:00
parent efb09b7254
commit 9325f9cc9e
4 changed files with 41 additions and 43 deletions

View File

@@ -6425,11 +6425,14 @@ nsDocShell::OnRedirectStateChange(nsIChannel* aOldChannel,
nsCOMPtr<nsIApplicationCacheChannel> appCacheChannel =
do_QueryInterface(aNewChannel);
if (appCacheChannel) {
// Permission will be checked in the parent process.
if (GeckoProcessType_Default != XRE_GetProcessType())
if (GeckoProcessType_Default != XRE_GetProcessType()) {
// Permission will be checked in the parent process.
appCacheChannel->SetChooseApplicationCache(true);
else
appCacheChannel->SetChooseApplicationCache(ShouldCheckAppCache(newURI));
} else {
appCacheChannel->SetChooseApplicationCache(
NS_ShouldCheckAppCache(newURI,
mInPrivateBrowsing));
}
}
if (!(aRedirectFlags & nsIChannelEventSink::REDIRECT_INTERNAL) &&
@@ -9169,26 +9172,6 @@ nsDocShell::GetInheritedPrincipal(bool aConsiderCurrentDocument)
return nullptr;
}
bool
nsDocShell::ShouldCheckAppCache(nsIURI *aURI)
{
if (mInPrivateBrowsing) {
return false;
}
nsCOMPtr<nsIOfflineCacheUpdateService> offlineService =
do_GetService(NS_OFFLINECACHEUPDATESERVICE_CONTRACTID);
if (!offlineService) {
return false;
}
bool allowed;
nsresult rv = offlineService->OfflineAppAllowedForURI(aURI,
nullptr,
&allowed);
return NS_SUCCEEDED(rv) && allowed;
}
nsresult
nsDocShell::DoURILoad(nsIURI * aURI,
nsIURI * aReferrerURI,
@@ -9276,12 +9259,13 @@ nsDocShell::DoURILoad(nsIURI * aURI,
// Loads with the correct permissions should check for a matching
// application cache.
// Permission will be checked in the parent process
if (GeckoProcessType_Default != XRE_GetProcessType())
if (GeckoProcessType_Default != XRE_GetProcessType()) {
// Permission will be checked in the parent process
appCacheChannel->SetChooseApplicationCache(true);
else
} else {
appCacheChannel->SetChooseApplicationCache(
ShouldCheckAppCache(aURI));
NS_ShouldCheckAppCache(aURI, mInPrivateBrowsing));
}
}
// Make sure to give the caller a channel if we managed to create one