mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1618536 - Introduce nsIContentPolicy::TYPE_INTERNAL_FONT_PRELOAD representing preload of font, mapping to TYPE_FONT externally, r=baku
Depends on D69628 Differential Revision: https://phabricator.services.mozilla.com/D72118
This commit is contained in:
parent
9e027ce534
commit
ef0d4e6dd1
@ -141,6 +141,7 @@ inline const char* NS_CP_ContentTypeName(uint32_t contentType) {
|
||||
CASE_RETURN(TYPE_INTERNAL_FORCE_ALLOWED_DTD);
|
||||
CASE_RETURN(TYPE_INTERNAL_AUDIOWORKLET);
|
||||
CASE_RETURN(TYPE_INTERNAL_PAINTWORKLET);
|
||||
CASE_RETURN(TYPE_INTERNAL_FONT_PRELOAD);
|
||||
default:
|
||||
return "<Unknown Type>";
|
||||
}
|
||||
|
@ -7990,7 +7990,8 @@ bool nsContentUtils::IsPreloadType(nsContentPolicyType aType) {
|
||||
return (aType == nsIContentPolicy::TYPE_INTERNAL_SCRIPT_PRELOAD ||
|
||||
aType == nsIContentPolicy::TYPE_INTERNAL_MODULE_PRELOAD ||
|
||||
aType == nsIContentPolicy::TYPE_INTERNAL_IMAGE_PRELOAD ||
|
||||
aType == nsIContentPolicy::TYPE_INTERNAL_STYLESHEET_PRELOAD);
|
||||
aType == nsIContentPolicy::TYPE_INTERNAL_STYLESHEET_PRELOAD ||
|
||||
aType == nsIContentPolicy::TYPE_INTERNAL_FONT_PRELOAD);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -3411,6 +3411,9 @@ nsContentUtils::InternalContentPolicyTypeToExternal(nsContentPolicyType aType) {
|
||||
case nsIContentPolicy::TYPE_INTERNAL_FORCE_ALLOWED_DTD:
|
||||
return nsIContentPolicy::TYPE_DTD;
|
||||
|
||||
case nsIContentPolicy::TYPE_INTERNAL_FONT_PRELOAD:
|
||||
return nsIContentPolicy::TYPE_FONT;
|
||||
|
||||
default:
|
||||
return aType;
|
||||
}
|
||||
|
@ -394,6 +394,12 @@ interface nsIContentPolicy : nsISupports
|
||||
*/
|
||||
const nsContentPolicyType TYPE_INTERNAL_PAINTWORKLET = 50;
|
||||
|
||||
/**
|
||||
* Same as TYPE_FONT but indicates this is a <link rel=preload as=font>
|
||||
* preload initiated load.
|
||||
*/
|
||||
const nsContentPolicyType TYPE_INTERNAL_FONT_PRELOAD = 51;
|
||||
|
||||
/* When adding new content types, please update
|
||||
* NS_CP_ContentTypeName, nsCSPContext, CSP_ContentTypeToDirective,
|
||||
* DoContentSecurityChecks, all nsIContentPolicy implementations, the
|
||||
|
3
dom/cache/DBSchema.cpp
vendored
3
dom/cache/DBSchema.cpp
vendored
@ -336,7 +336,8 @@ static_assert(nsIContentPolicy::TYPE_INVALID == 0 &&
|
||||
nsIContentPolicy::TYPE_INTERNAL_DTD == 47 &&
|
||||
nsIContentPolicy::TYPE_INTERNAL_FORCE_ALLOWED_DTD == 48 &&
|
||||
nsIContentPolicy::TYPE_INTERNAL_AUDIOWORKLET == 49 &&
|
||||
nsIContentPolicy::TYPE_INTERNAL_PAINTWORKLET == 50,
|
||||
nsIContentPolicy::TYPE_INTERNAL_PAINTWORKLET == 50 &&
|
||||
nsIContentPolicy::TYPE_INTERNAL_FONT_PRELOAD == 51,
|
||||
"nsContentPolicyType values are as expected");
|
||||
|
||||
namespace {
|
||||
|
@ -293,6 +293,7 @@ RequestDestination InternalRequest::MapContentPolicyTypeToRequestDestination(
|
||||
destination = RequestDestination::_empty;
|
||||
break;
|
||||
case nsIContentPolicy::TYPE_FONT:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_FONT_PRELOAD:
|
||||
destination = RequestDestination::Font;
|
||||
break;
|
||||
case nsIContentPolicy::TYPE_MEDIA:
|
||||
|
@ -42,7 +42,7 @@ namespace dom {
|
||||
* audioworklet | TYPE_INTERNAL_AUDIOWORKLET
|
||||
* document | TYPE_DOCUMENT, TYPE_INTERNAL_IFRAME, TYPE_SUBDOCUMENT
|
||||
* embed | TYPE_INTERNAL_EMBED
|
||||
* font | TYPE_FONT
|
||||
* font | TYPE_FONT, TYPE_INTERNAL_FONT_PRELOAD
|
||||
* image | TYPE_INTERNAL_IMAGE, TYPE_INTERNAL_IMAGE_PRELOAD,
|
||||
* | TYPE_IMAGE, TYPE_INTERNAL_IMAGE_FAVICON, TYPE_IMAGESET
|
||||
* manifest | TYPE_WEB_MANIFEST
|
||||
|
@ -75,6 +75,7 @@ nsCString MapInternalContentPolicyTypeToDest(nsContentPolicyType aType) {
|
||||
case nsIContentPolicy::TYPE_INTERNAL_FORCE_ALLOWED_DTD:
|
||||
return NS_LITERAL_CSTRING("empty");
|
||||
case nsIContentPolicy::TYPE_FONT:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_FONT_PRELOAD:
|
||||
return NS_LITERAL_CSTRING("font");
|
||||
case nsIContentPolicy::TYPE_MEDIA:
|
||||
return NS_LITERAL_CSTRING("empty");
|
||||
|
@ -271,6 +271,7 @@ CSPDirective CSP_ContentTypeToDirective(nsContentPolicyType aType) {
|
||||
return nsIContentSecurityPolicy::STYLE_SRC_DIRECTIVE;
|
||||
|
||||
case nsIContentPolicy::TYPE_FONT:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_FONT_PRELOAD:
|
||||
return nsIContentSecurityPolicy::FONT_SRC_DIRECTIVE;
|
||||
|
||||
case nsIContentPolicy::TYPE_MEDIA:
|
||||
|
Loading…
Reference in New Issue
Block a user