mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 23:23:33 +00:00
Bug 467035 - Add new internal DTD content types r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D35232 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
ace536fb97
commit
dbce01f2ff
@ -138,6 +138,8 @@ inline const char* NS_CP_ContentTypeName(uint32_t contentType) {
|
||||
CASE_RETURN(TYPE_SPECULATIVE);
|
||||
CASE_RETURN(TYPE_INTERNAL_MODULE);
|
||||
CASE_RETURN(TYPE_INTERNAL_MODULE_PRELOAD);
|
||||
CASE_RETURN(TYPE_INTERNAL_DTD);
|
||||
CASE_RETURN(TYPE_INTERNAL_FORCE_ALLOWED_DTD);
|
||||
default:
|
||||
return "<Unknown Type>";
|
||||
}
|
||||
|
@ -3326,6 +3326,10 @@ nsContentUtils::InternalContentPolicyTypeToExternal(nsContentPolicyType aType) {
|
||||
case nsIContentPolicy::TYPE_INTERNAL_STYLESHEET_PRELOAD:
|
||||
return nsIContentPolicy::TYPE_STYLESHEET;
|
||||
|
||||
case nsIContentPolicy::TYPE_INTERNAL_DTD:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_FORCE_ALLOWED_DTD:
|
||||
return nsIContentPolicy::TYPE_DTD;
|
||||
|
||||
default:
|
||||
return aType;
|
||||
}
|
||||
|
@ -364,6 +364,18 @@ interface nsIContentPolicy : nsISupports
|
||||
*/
|
||||
const nsContentPolicyType TYPE_INTERNAL_MODULE_PRELOAD = 46;
|
||||
|
||||
/**
|
||||
* Indicates a DTD loaded by an XML document the URI of which could
|
||||
* not be mapped to a known local DTD.
|
||||
*/
|
||||
const nsContentPolicyType TYPE_INTERNAL_DTD = 47;
|
||||
|
||||
/**
|
||||
* Indicates a TYPE_INTERNAL_DTD which will not be blocked no matter
|
||||
* what principal is being loaded from.
|
||||
*/
|
||||
const nsContentPolicyType TYPE_INTERNAL_FORCE_ALLOWED_DTD = 48;
|
||||
|
||||
/* When adding new content types, please update nsContentBlocker,
|
||||
* NS_CP_ContentTypeName, nsCSPContext, CSP_ContentTypeToDirective,
|
||||
* DoContentSecurityChecks, all nsIContentPolicy implementations, the
|
||||
|
4
dom/cache/DBSchema.cpp
vendored
4
dom/cache/DBSchema.cpp
vendored
@ -333,7 +333,9 @@ static_assert(nsIContentPolicy::TYPE_INVALID == 0 &&
|
||||
nsIContentPolicy::TYPE_SAVEAS_DOWNLOAD == 43 &&
|
||||
nsIContentPolicy::TYPE_SPECULATIVE == 44 &&
|
||||
nsIContentPolicy::TYPE_INTERNAL_MODULE == 45 &&
|
||||
nsIContentPolicy::TYPE_INTERNAL_MODULE_PRELOAD == 46,
|
||||
nsIContentPolicy::TYPE_INTERNAL_MODULE_PRELOAD == 46 &&
|
||||
nsIContentPolicy::TYPE_INTERNAL_DTD == 47 &&
|
||||
nsIContentPolicy::TYPE_INTERNAL_FORCE_ALLOWED_DTD == 48,
|
||||
"nsContentPolicyType values are as expected");
|
||||
|
||||
namespace {
|
||||
|
@ -254,6 +254,8 @@ RequestDestination InternalRequest::MapContentPolicyTypeToRequestDestination(
|
||||
destination = RequestDestination::_empty;
|
||||
break;
|
||||
case nsIContentPolicy::TYPE_DTD:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_DTD:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_FORCE_ALLOWED_DTD:
|
||||
destination = RequestDestination::_empty;
|
||||
break;
|
||||
case nsIContentPolicy::TYPE_FONT:
|
||||
|
@ -268,6 +268,8 @@ CSPDirective CSP_ContentTypeToDirective(nsContentPolicyType aType) {
|
||||
case nsIContentPolicy::TYPE_DTD:
|
||||
case nsIContentPolicy::TYPE_OTHER:
|
||||
case nsIContentPolicy::TYPE_SPECULATIVE:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_DTD:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_FORCE_ALLOWED_DTD:
|
||||
return nsIContentSecurityPolicy::DEFAULT_SRC_DIRECTIVE;
|
||||
|
||||
// csp shold not block top level loads, e.g. in case
|
||||
|
@ -71,6 +71,8 @@ static const nsLiteralCString kTypeString[] = {
|
||||
NS_LITERAL_CSTRING("speculative"),
|
||||
NS_LITERAL_CSTRING(""), // TYPE_INTERNAL_MODULE
|
||||
NS_LITERAL_CSTRING(""), // TYPE_INTERNAL_MODULE_PRELOAD
|
||||
NS_LITERAL_CSTRING(""), // TYPE_INTERNAL_DTD
|
||||
NS_LITERAL_CSTRING(""), // TYPE_INTERNAL_FORCE_ALLOWED_DTD
|
||||
};
|
||||
|
||||
#define NUMBER_OF_TYPES MOZ_ARRAY_LENGTH(kTypeString)
|
||||
|
Loading…
x
Reference in New Issue
Block a user