mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 802885 - Disable offline cache entries for private channels under e10s r=jdm
This commit is contained in:
parent
44e6bd9d0c
commit
d8a4aa9db2
@ -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
|
||||
|
@ -282,10 +282,6 @@ protected:
|
||||
// at the parent.
|
||||
nsIPrincipal* GetInheritedPrincipal(bool aConsiderCurrentDocument);
|
||||
|
||||
// True if when loading aURI into this docshell, the channel should look
|
||||
// for an appropriate application cache.
|
||||
bool ShouldCheckAppCache(nsIURI * aURI);
|
||||
|
||||
// Actually open a channel and perform a URI load. Note: whatever owner is
|
||||
// passed to this function will be set on the channel. Callers who wish to
|
||||
// not have an owner on the channel should just pass null.
|
||||
|
@ -78,6 +78,7 @@
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsIPrivateBrowsingChannel.h"
|
||||
#include "mozIApplicationClearPrivateDataParams.h"
|
||||
#include "nsIOfflineCacheUpdate.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
@ -1375,6 +1376,29 @@ NS_GetAppInfoFromClearDataNotification(nsISupports *aSubject,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether appcache should be checked for a given URI.
|
||||
*/
|
||||
inline bool
|
||||
NS_ShouldCheckAppCache(nsIURI *aURI, bool usePrivateBrowsing)
|
||||
{
|
||||
if (usePrivateBrowsing) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIOfflineCacheUpdateService> offlineService =
|
||||
do_GetService("@mozilla.org/offlinecacheupdate-service;1");
|
||||
if (!offlineService) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool allowed;
|
||||
nsresult rv = offlineService->OfflineAppAllowedForURI(aURI,
|
||||
nullptr,
|
||||
&allowed);
|
||||
return NS_SUCCEEDED(rv) && allowed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps an nsIAuthPrompt so that it can be used as an nsIAuthPrompt2. This
|
||||
* method is provided mainly for use by other methods in this file.
|
||||
|
@ -211,7 +211,7 @@ HttpChannelParent::RecvAsyncOpen(const URIParams& aURI,
|
||||
bool setChooseApplicationCache = chooseApplicationCache;
|
||||
if (appCacheChan && appCacheService) {
|
||||
// We might potentially want to drop this flag (that is TRUE by default)
|
||||
// after we succefully associate the channel with an application cache
|
||||
// after we successfully associate the channel with an application cache
|
||||
// reported by the channel child. Dropping it here may be too early.
|
||||
appCacheChan->SetInheritApplicationCache(false);
|
||||
if (!appCacheClientID.IsEmpty()) {
|
||||
@ -225,16 +225,10 @@ HttpChannelParent::RecvAsyncOpen(const URIParams& aURI,
|
||||
}
|
||||
|
||||
if (setChooseApplicationCache) {
|
||||
nsCOMPtr<nsIOfflineCacheUpdateService> offlineUpdateService =
|
||||
do_GetService("@mozilla.org/offlinecacheupdate-service;1", &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = offlineUpdateService->OfflineAppAllowedForURI(uri,
|
||||
nullptr,
|
||||
&setChooseApplicationCache);
|
||||
|
||||
if (setChooseApplicationCache && NS_SUCCEEDED(rv))
|
||||
appCacheChan->SetChooseApplicationCache(true);
|
||||
}
|
||||
// This works because we've already called SetNotificationCallbacks and
|
||||
// done mPBOverride logic by this point.
|
||||
appCacheChan->SetChooseApplicationCache(
|
||||
NS_ShouldCheckAppCache(uri, NS_UsePrivateBrowsing(mChannel)));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user