зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1642149 - P2 ImportScript() in workers must respect the coressponding COEP header r=dom-workers-and-storage-reviewers,perry
When loading a sub-script in workers, the corresponding COEP must be set on the channel's nsILoadInfo, such that its CORP header can be checked as expected. Differential Revision: https://phabricator.services.mozilla.com/D77720
This commit is contained in:
Родитель
400b4664ad
Коммит
8c86a3e215
|
@ -1119,6 +1119,22 @@ class ScriptLoaderRunnable final : public nsIRunnable, public nsINamed {
|
|||
}
|
||||
}
|
||||
|
||||
if (StaticPrefs::browser_tabs_remote_useCrossOriginEmbedderPolicy()) {
|
||||
nsILoadInfo::CrossOriginEmbedderPolicy respectedCOEP =
|
||||
mWorkerPrivate->GetEmbedderPolicy();
|
||||
if (mWorkerPrivate->IsDedicatedWorker() &&
|
||||
respectedCOEP == nsILoadInfo::EMBEDDER_POLICY_NULL) {
|
||||
respectedCOEP = mWorkerPrivate->GetOwnerEmbedderPolicy();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsILoadInfo> channelLoadInfo;
|
||||
rv = channel->GetLoadInfo(getter_AddRefs(channelLoadInfo));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
channelLoadInfo->SetLoadingEmbedderPolicy(respectedCOEP);
|
||||
}
|
||||
|
||||
if (loadInfo.mCacheStatus != ScriptLoadInfo::ToBeCached) {
|
||||
rv = channel->AsyncOpen(loader);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[require-corp-sw.https.html]
|
||||
[importScripts() fails for a script with no corp.]
|
||||
expected: FAIL
|
||||
|
Загрузка…
Ссылка в новой задаче