mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1087320 - On charset reload set LOAD_FROM_CACHE only on the default channel, r=bz r=jduell
This commit is contained in:
parent
f805628f6a
commit
c0585d2bda
@ -10984,9 +10984,15 @@ nsDocShell::DoChannelLoad(nsIChannel* aChannel,
|
||||
break;
|
||||
}
|
||||
|
||||
case LOAD_RELOAD_CHARSET_CHANGE:
|
||||
loadFlags |= nsIRequest::LOAD_FROM_CACHE;
|
||||
case LOAD_RELOAD_CHARSET_CHANGE: {
|
||||
// Use SetAllowStaleCacheContent (not LOAD_FROM_CACHE flag) since we only want
|
||||
// to force cache load for this channel, not the whole loadGroup.
|
||||
nsCOMPtr<nsICacheInfoChannel> cachingChannel = do_QueryInterface(aChannel);
|
||||
if (cachingChannel) {
|
||||
cachingChannel->SetAllowStaleCacheContent(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case LOAD_RELOAD_NORMAL:
|
||||
case LOAD_REFRESH:
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid (c5f583f0-ae53-4e39-8af9-2c2d0d7af093)]
|
||||
[scriptable, uuid(72c34415-c6eb-48af-851f-772fa9ee5972)]
|
||||
interface nsICacheInfoChannel : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -45,4 +45,11 @@ interface nsICacheInfoChannel : nsISupports
|
||||
* is likewise valid.
|
||||
*/
|
||||
attribute nsISupports cacheKey;
|
||||
|
||||
/**
|
||||
* Tells the channel to behave as if the LOAD_FROM_CACHE flag has been set,
|
||||
* but without affecting the loads for the entire loadGroup in case of this
|
||||
* channel being the default load group's channel.
|
||||
*/
|
||||
attribute boolean allowStaleCacheContent;
|
||||
};
|
||||
|
@ -116,6 +116,7 @@ struct HttpChannelOpenArgs
|
||||
OptionalCorsPreflightArgs preflightArgs;
|
||||
uint32_t initialRwin;
|
||||
bool suspendAfterSynthesizeResponse;
|
||||
bool allowStaleCacheContent;
|
||||
};
|
||||
|
||||
struct HttpChannelConnectArgs
|
||||
|
@ -87,6 +87,7 @@ HttpBaseChannel::HttpBaseChannel()
|
||||
, mAllRedirectsSameOrigin(true)
|
||||
, mAllRedirectsPassTimingAllowCheck(true)
|
||||
, mResponseCouldBeSynthesized(false)
|
||||
, mAllowStaleCacheContent(false)
|
||||
, mSuspendCount(0)
|
||||
, mInitialRwin(0)
|
||||
, mProxyResolveFlags(0)
|
||||
|
@ -431,6 +431,10 @@ protected:
|
||||
// True if this channel was intercepted and could receive a synthesized response.
|
||||
uint32_t mResponseCouldBeSynthesized : 1;
|
||||
|
||||
// If true, we behave as if the LOAD_FROM_CACHE flag has been set.
|
||||
// Used to enforce that flag's behavior but not expose it externally.
|
||||
uint32_t mAllowStaleCacheContent : 1;
|
||||
|
||||
// Current suspension depth for this channel object
|
||||
uint32_t mSuspendCount;
|
||||
|
||||
|
@ -1964,6 +1964,8 @@ HttpChannelChild::ContinueAsyncOpen()
|
||||
}
|
||||
openArgs.cacheKey() = cacheKey;
|
||||
|
||||
openArgs.allowStaleCacheContent() = mAllowStaleCacheContent;
|
||||
|
||||
nsresult rv = mozilla::ipc::LoadInfoToLoadInfoArgs(mLoadInfo, &openArgs.loadInfo());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -2123,6 +2125,20 @@ HttpChannelChild::SetCacheKey(nsISupports *cacheKey)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpChannelChild::SetAllowStaleCacheContent(bool aAllowStaleCacheContent)
|
||||
{
|
||||
mAllowStaleCacheContent = aAllowStaleCacheContent;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
HttpChannelChild::GetAllowStaleCacheContent(bool *aAllowStaleCacheContent)
|
||||
{
|
||||
NS_ENSURE_ARG(aAllowStaleCacheContent);
|
||||
*aAllowStaleCacheContent = mAllowStaleCacheContent;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// HttpChannelChild::nsIResumableChannel
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -131,7 +131,8 @@ HttpChannelParent::Init(const HttpChannelCreationArgs& aArgs)
|
||||
a.loadInfo(), a.synthesizedResponseHead(),
|
||||
a.synthesizedSecurityInfoSerialization(),
|
||||
a.cacheKey(), a.schedulingContextID(), a.preflightArgs(),
|
||||
a.initialRwin(), a.suspendAfterSynthesizeResponse());
|
||||
a.initialRwin(), a.suspendAfterSynthesizeResponse(),
|
||||
a.allowStaleCacheContent());
|
||||
}
|
||||
case HttpChannelCreationArgs::THttpChannelConnectArgs:
|
||||
{
|
||||
@ -264,7 +265,8 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
||||
const nsCString& aSchedulingContextID,
|
||||
const OptionalCorsPreflightArgs& aCorsPreflightArgs,
|
||||
const uint32_t& aInitialRwin,
|
||||
const bool& aSuspendAfterSynthesizeResponse)
|
||||
const bool& aSuspendAfterSynthesizeResponse,
|
||||
const bool& aAllowStaleCacheContent)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
|
||||
if (!uri) {
|
||||
@ -413,6 +415,8 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
||||
|
||||
mChannel->SetCacheKey(cacheKey);
|
||||
|
||||
mChannel->SetAllowStaleCacheContent(aAllowStaleCacheContent);
|
||||
|
||||
if (priority != nsISupportsPriority::PRIORITY_NORMAL) {
|
||||
mChannel->SetPriority(priority);
|
||||
}
|
||||
|
@ -137,7 +137,8 @@ protected:
|
||||
const nsCString& aSchedulingContextID,
|
||||
const OptionalCorsPreflightArgs& aCorsPreflightArgs,
|
||||
const uint32_t& aInitialRwin,
|
||||
const bool& aSuspendAfterSynthesizeResponse);
|
||||
const bool& aSuspendAfterSynthesizeResponse,
|
||||
const bool& aAllowStaleCacheContent);
|
||||
|
||||
virtual bool RecvSetPriority(const uint16_t& priority) override;
|
||||
virtual bool RecvSetClassOfService(const uint32_t& cos) override;
|
||||
|
@ -481,6 +481,10 @@ nsHttpChannel::SpeculativeConnect()
|
||||
LOAD_NO_NETWORK_IO | LOAD_CHECK_OFFLINE_CACHE))
|
||||
return;
|
||||
|
||||
if (mAllowStaleCacheContent) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInterfaceRequestor> callbacks;
|
||||
NS_NewNotificationCallbacksAggregation(mCallbacks, mLoadGroup,
|
||||
getter_AddRefs(callbacks));
|
||||
@ -3180,7 +3184,7 @@ nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, nsIApplicationCache* appC
|
||||
doValidation = false;
|
||||
}
|
||||
// If the LOAD_FROM_CACHE flag is set, any cached data can simply be used
|
||||
else if (mLoadFlags & nsIRequest::LOAD_FROM_CACHE) {
|
||||
else if (mLoadFlags & nsIRequest::LOAD_FROM_CACHE || mAllowStaleCacheContent) {
|
||||
LOG(("NOT validating based on LOAD_FROM_CACHE load flag\n"));
|
||||
doValidation = false;
|
||||
}
|
||||
@ -6283,6 +6287,22 @@ nsHttpChannel::SetCacheTokenCachedCharset(const nsACString &aCharset)
|
||||
PromiseFlatCString(aCharset).get());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::SetAllowStaleCacheContent(bool aAllowStaleCacheContent)
|
||||
{
|
||||
LOG(("nsHttpChannel::SetAllowStaleCacheContent [this=%p, allow=%d]",
|
||||
this, aAllowStaleCacheContent));
|
||||
mAllowStaleCacheContent = aAllowStaleCacheContent;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetAllowStaleCacheContent(bool *aAllowStaleCacheContent)
|
||||
{
|
||||
NS_ENSURE_ARG(aAllowStaleCacheContent);
|
||||
*aAllowStaleCacheContent = mAllowStaleCacheContent;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsHttpChannel::nsICachingChannel
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user