зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1482129 - Exempt stylesheets, fonts and images when canceling loading of slow HTTP requests of tracking resources; r=valentin
This commit is contained in:
Родитель
e76d5d449a
Коммит
7d314b5011
|
@ -348,10 +348,11 @@ interface nsIContentPolicy : nsISupports
|
|||
|
||||
/* When adding new content types, please update nsContentBlocker,
|
||||
* NS_CP_ContentTypeName, nsCSPContext, CSP_ContentTypeToDirective,
|
||||
* DoContentSecurityChecks, all nsIContentPolicy implementations, the
|
||||
* static_assert in dom/cache/DBSchema.cpp, ChannelWrapper.webidl,
|
||||
* ChannelWrapper.cpp, nsPermissionManager.cpp, and other things that are not
|
||||
* listed here that are related to nsIContentPolicy. */
|
||||
* DoContentSecurityChecks, IsContentPolicyTypeWhitelistedForFastBlock,
|
||||
* all nsIContentPolicy implementations, the static_assert in
|
||||
* dom/cache/DBSchema.cpp, ChannelWrapper.webidl, ChannelWrapper.cpp,
|
||||
* nsPermissionManager.cpp, and other things that are not listed here
|
||||
* that are related to nsIContentPolicy. */
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -596,6 +596,31 @@ nsHttpChannel::Connect()
|
|||
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
|
||||
nsHttpChannel::CheckFastBlocked()
|
||||
{
|
||||
|
@ -616,7 +641,9 @@ nsHttpChannel::CheckFastBlocked()
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!sIsFastBlockEnabled || !timestamp) {
|
||||
if (!sIsFastBlockEnabled ||
|
||||
IsContentPolicyTypeWhitelistedForFastBlock(mLoadInfo) ||
|
||||
!timestamp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче