mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
Bug 1402784
- Introduce nsIContentPolicy::TYPE_INTERNAL_AUDIOWORKLET and nsIContentPolicy::TYPE_INTERNAL_PAINTWORKLET, r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D67105 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
b503a043c8
commit
96d0e4f828
@ -139,6 +139,8 @@ inline const char* NS_CP_ContentTypeName(uint32_t contentType) {
|
||||
CASE_RETURN(TYPE_INTERNAL_MODULE_PRELOAD);
|
||||
CASE_RETURN(TYPE_INTERNAL_DTD);
|
||||
CASE_RETURN(TYPE_INTERNAL_FORCE_ALLOWED_DTD);
|
||||
CASE_RETURN(TYPE_INTERNAL_AUDIOWORKLET);
|
||||
CASE_RETURN(TYPE_INTERNAL_PAINTWORKLET);
|
||||
default:
|
||||
return "<Unknown Type>";
|
||||
}
|
||||
|
@ -3387,6 +3387,8 @@ nsContentUtils::InternalContentPolicyTypeToExternal(nsContentPolicyType aType) {
|
||||
case nsIContentPolicy::TYPE_INTERNAL_SHARED_WORKER:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_SERVICE_WORKER:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_WORKER_IMPORT_SCRIPTS:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_AUDIOWORKLET:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_PAINTWORKLET:
|
||||
return nsIContentPolicy::TYPE_SCRIPT;
|
||||
|
||||
case nsIContentPolicy::TYPE_INTERNAL_EMBED:
|
||||
|
@ -376,6 +376,24 @@ interface nsIContentPolicy : nsISupports
|
||||
*/
|
||||
const nsContentPolicyType TYPE_INTERNAL_FORCE_ALLOWED_DTD = 48;
|
||||
|
||||
/**
|
||||
* Indicates an internal constant for scripts loaded through an
|
||||
* audioWorklet.
|
||||
*
|
||||
* This will be mapped to TYPE_SCRIPT before being passed to content policy
|
||||
* implementations.
|
||||
*/
|
||||
const nsContentPolicyType TYPE_INTERNAL_AUDIOWORKLET = 49;
|
||||
|
||||
/**
|
||||
* Indicates an internal constant for scripts loaded through an
|
||||
* paintWorklet.
|
||||
*
|
||||
* This will be mapped to TYPE_SCRIPT before being passed to content policy
|
||||
* implementations.
|
||||
*/
|
||||
const nsContentPolicyType TYPE_INTERNAL_PAINTWORKLET = 50;
|
||||
|
||||
/* When adding new content types, please update
|
||||
* NS_CP_ContentTypeName, nsCSPContext, CSP_ContentTypeToDirective,
|
||||
* DoContentSecurityChecks, all nsIContentPolicy implementations, the
|
||||
|
4
dom/cache/DBSchema.cpp
vendored
4
dom/cache/DBSchema.cpp
vendored
@ -334,7 +334,9 @@ static_assert(nsIContentPolicy::TYPE_INVALID == 0 &&
|
||||
nsIContentPolicy::TYPE_INTERNAL_MODULE == 45 &&
|
||||
nsIContentPolicy::TYPE_INTERNAL_MODULE_PRELOAD == 46 &&
|
||||
nsIContentPolicy::TYPE_INTERNAL_DTD == 47 &&
|
||||
nsIContentPolicy::TYPE_INTERNAL_FORCE_ALLOWED_DTD == 48,
|
||||
nsIContentPolicy::TYPE_INTERNAL_FORCE_ALLOWED_DTD == 48 &&
|
||||
nsIContentPolicy::TYPE_INTERNAL_AUDIOWORKLET == 49 &&
|
||||
nsIContentPolicy::TYPE_INTERNAL_PAINTWORKLET == 50,
|
||||
"nsContentPolicyType values are as expected");
|
||||
|
||||
namespace {
|
||||
|
@ -330,6 +330,12 @@ RequestDestination InternalRequest::MapContentPolicyTypeToRequestDestination(
|
||||
case nsIContentPolicy::TYPE_SPECULATIVE:
|
||||
destination = RequestDestination::_empty;
|
||||
break;
|
||||
case nsIContentPolicy::TYPE_INTERNAL_AUDIOWORKLET:
|
||||
destination = RequestDestination::Audioworklet;
|
||||
break;
|
||||
case nsIContentPolicy::TYPE_INTERNAL_PAINTWORKLET:
|
||||
destination = RequestDestination::Paintworklet;
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(false, "Unhandled nsContentPolicyType value");
|
||||
break;
|
||||
|
@ -38,7 +38,7 @@ namespace dom {
|
||||
* RequestDestination| nsContentPolicyType
|
||||
* ------------------+--------------------
|
||||
* audio | TYPE_INTERNAL_AUDIO
|
||||
* audioworklet | TODO
|
||||
* audioworklet | TYPE_INTERNAL_AUDIOWORKLET
|
||||
* document | TYPE_DOCUMENT, TYPE_INTERNAL_IFRAME, TYPE_SUBDOCUMENT
|
||||
* embed | TYPE_INTERNAL_EMBED
|
||||
* font | TYPE_FONT
|
||||
@ -46,7 +46,7 @@ namespace dom {
|
||||
* | TYPE_IMAGE, TYPE_INTERNAL_IMAGE_FAVICON, TYPE_IMAGESET
|
||||
* manifest | TYPE_WEB_MANIFEST
|
||||
* object | TYPE_INTERNAL_OBJECT, TYPE_OBJECT
|
||||
* "paintworklet" | TODO
|
||||
* "paintworklet" | TYPE_INTERNAL_PAINTWORKLET
|
||||
* report" | TODO
|
||||
* script | TYPE_INTERNAL_SCRIPT, TYPE_INTERNAL_SCRIPT_PRELOAD,
|
||||
* | TYPE_INTERNAL_MODULE, TYPE_INTERNAL_MODULE_PRELOAD,
|
||||
|
@ -31,6 +31,10 @@ nsCString MapInternalContentPolicyTypeToDest(nsContentPolicyType aType) {
|
||||
return NS_LITERAL_CSTRING("sharedworker");
|
||||
case nsIContentPolicy::TYPE_INTERNAL_SERVICE_WORKER:
|
||||
return NS_LITERAL_CSTRING("serviceworker");
|
||||
case nsIContentPolicy::TYPE_INTERNAL_AUDIOWORKLET:
|
||||
return NS_LITERAL_CSTRING("audioworklet");
|
||||
case nsIContentPolicy::TYPE_INTERNAL_PAINTWORKLET:
|
||||
return NS_LITERAL_CSTRING("paintworklet");
|
||||
case nsIContentPolicy::TYPE_IMAGESET:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_IMAGE:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_IMAGE_PRELOAD:
|
||||
|
@ -263,6 +263,8 @@ CSPDirective CSP_ContentTypeToDirective(nsContentPolicyType aType) {
|
||||
case nsIContentPolicy::TYPE_INTERNAL_MODULE:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_MODULE_PRELOAD:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_WORKER_IMPORT_SCRIPTS:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_AUDIOWORKLET:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_PAINTWORKLET:
|
||||
return nsIContentSecurityPolicy::SCRIPT_SRC_DIRECTIVE;
|
||||
|
||||
case nsIContentPolicy::TYPE_STYLESHEET:
|
||||
|
@ -1599,6 +1599,11 @@ nsresult EnsureMIMEOfScript(nsHttpChannel* aChannel, nsIURI* aURI,
|
||||
AccumulateCategorical(
|
||||
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::importScript_load);
|
||||
break;
|
||||
case nsIContentPolicy::TYPE_INTERNAL_AUDIOWORKLET:
|
||||
case nsIContentPolicy::TYPE_INTERNAL_PAINTWORKLET:
|
||||
AccumulateCategorical(
|
||||
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::worklet_load);
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("unexpected script type");
|
||||
break;
|
||||
|
@ -8844,7 +8844,7 @@
|
||||
"bug_numbers": [1288361, 1299267, 1399990, 1510225, 1581559],
|
||||
"expires_in_version": "never",
|
||||
"kind": "categorical",
|
||||
"labels": ["unknown","javaScript","image", "audio", "video","text_plain","text_csv","text_xml","app_octet_stream","app_xml","app_json","text_json","text_html","empty","serviceworker_load","worker_load","importScript_load","script_load","same_origin","CORS_origin","cross_origin"],
|
||||
"labels": ["unknown","javaScript","image", "audio", "video","text_plain","text_csv","text_xml","app_octet_stream","app_xml","app_json","text_json","text_html","empty","serviceworker_load","worker_load","importScript_load","script_load","same_origin","CORS_origin","cross_origin", "worklet_load"],
|
||||
"description": "Whether the script load has a MIME type of ...? (unknown, javaScript, image, audio, video, text_plain, text_csv, text_xml, app_octet_stream, app_xml, app_json, text_json, text_html, empty). Whether the script load is from ...? (serviceworker_load, worker_load, importSript_load, script_load). Whether the script load is of ...? (same_origin, CORS_origin, cross_origin)"
|
||||
},
|
||||
"NEWTAB_PAGE_ENABLED": {
|
||||
|
Loading…
Reference in New Issue
Block a user