mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
Bug 1482129 - Exempt stylesheets, fonts and images when canceling loading of slow HTTP requests of tracking resources; r=valentin
This commit is contained in:
parent
e76d5d449a
commit
7d314b5011
@ -348,10 +348,11 @@ interface nsIContentPolicy : nsISupports
|
|||||||
|
|
||||||
/* When adding new content types, please update nsContentBlocker,
|
/* When adding new content types, please update nsContentBlocker,
|
||||||
* NS_CP_ContentTypeName, nsCSPContext, CSP_ContentTypeToDirective,
|
* NS_CP_ContentTypeName, nsCSPContext, CSP_ContentTypeToDirective,
|
||||||
* DoContentSecurityChecks, all nsIContentPolicy implementations, the
|
* DoContentSecurityChecks, IsContentPolicyTypeWhitelistedForFastBlock,
|
||||||
* static_assert in dom/cache/DBSchema.cpp, ChannelWrapper.webidl,
|
* all nsIContentPolicy implementations, the static_assert in
|
||||||
* ChannelWrapper.cpp, nsPermissionManager.cpp, and other things that are not
|
* dom/cache/DBSchema.cpp, ChannelWrapper.webidl, ChannelWrapper.cpp,
|
||||||
* listed here that are related to nsIContentPolicy. */
|
* nsPermissionManager.cpp, and other things that are not listed here
|
||||||
|
* that are related to nsIContentPolicy. */
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -596,6 +596,31 @@ nsHttpChannel::Connect()
|
|||||||
return ConnectOnTailUnblock();
|
return ConnectOnTailUnblock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
IsContentPolicyTypeWhitelistedForFastBlock(nsILoadInfo* aLoadInfo)
|
||||||
|
{
|
||||||
|
nsContentPolicyType type = aLoadInfo ?
|
||||||
|
aLoadInfo->GetExternalContentPolicyType() :
|
||||||
|
nsIContentPolicy::TYPE_OTHER;
|
||||||
|
switch (type) {
|
||||||
|
// images
|
||||||
|
case nsIContentPolicy::TYPE_IMAGE:
|
||||||
|
case nsIContentPolicy::TYPE_IMAGESET:
|
||||||
|
case nsIContentPolicy::TYPE_INTERNAL_IMAGE:
|
||||||
|
case nsIContentPolicy::TYPE_INTERNAL_IMAGE_PRELOAD:
|
||||||
|
case nsIContentPolicy::TYPE_INTERNAL_IMAGE_FAVICON:
|
||||||
|
// fonts
|
||||||
|
case nsIContentPolicy::TYPE_FONT:
|
||||||
|
// stylesheets
|
||||||
|
case nsIContentPolicy::TYPE_STYLESHEET:
|
||||||
|
case nsIContentPolicy::TYPE_INTERNAL_STYLESHEET:
|
||||||
|
case nsIContentPolicy::TYPE_INTERNAL_STYLESHEET_PRELOAD:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsHttpChannel::CheckFastBlocked()
|
nsHttpChannel::CheckFastBlocked()
|
||||||
{
|
{
|
||||||
@ -616,7 +641,9 @@ nsHttpChannel::CheckFastBlocked()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sIsFastBlockEnabled || !timestamp) {
|
if (!sIsFastBlockEnabled ||
|
||||||
|
IsContentPolicyTypeWhitelistedForFastBlock(mLoadInfo) ||
|
||||||
|
!timestamp) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user