зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1847548 - Part 1: Use nsIContentPolicy::TYPE_INTERNAL_MODULE for worker's dynamic import scripts. r=dom-worker-reviewers,smaug,evilpie
Differential Revision: https://phabricator.services.mozilla.com/D185563
This commit is contained in:
Родитель
3738fe3f44
Коммит
e2668be1a6
|
@ -336,7 +336,11 @@ interface nsIContentPolicy : nsISupports
|
|||
|
||||
/**
|
||||
* Indicates an internal constant for ES6 module scripts
|
||||
* loaded through script elements or an import statement.
|
||||
* loaded through script elements or an import statement (static import) or
|
||||
* an import expression (dynamic import).
|
||||
* It also indicates the load for dynamic import in workers.
|
||||
* For static import in module workers,
|
||||
* please check TYPE_INTERNAL_WORKER_STATIC_MODULE.
|
||||
*
|
||||
* This will be mapped to TYPE_SCRIPT before being passed
|
||||
* to content policy implementations.
|
||||
|
|
|
@ -602,6 +602,10 @@ nsContentPolicyType WorkerScriptLoader::GetContentPolicyType(
|
|||
return mWorkerRef->Private()->ContentPolicyType();
|
||||
}
|
||||
if (aRequest->IsModuleRequest()) {
|
||||
if (aRequest->AsModuleRequest()->IsDynamicImport()) {
|
||||
return nsIContentPolicy::TYPE_INTERNAL_MODULE;
|
||||
}
|
||||
|
||||
// Implements the destination for Step 14 in
|
||||
// https://html.spec.whatwg.org/#worker-processing-model
|
||||
//
|
||||
|
@ -610,6 +614,7 @@ nsContentPolicyType WorkerScriptLoader::GetContentPolicyType(
|
|||
// "sharedworker".
|
||||
return nsIContentPolicy::TYPE_INTERNAL_WORKER_STATIC_MODULE;
|
||||
}
|
||||
// For script imported in worker's importScripts().
|
||||
return nsIContentPolicy::TYPE_INTERNAL_WORKER_IMPORT_SCRIPTS;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче