mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 16:28:38 +09:00
Issue #2402 - ServiceWorker should not inherit CSP from registration principal. https://bugzilla.mozilla.org/show_bug.cgi?id=1337543
This commit is contained in:
parent
bfa8ea9368
commit
1703d936af
1 changed files with 10 additions and 11 deletions
|
|
@ -1760,23 +1760,22 @@ ServiceWorkerPrivate::SpawnWorkerIfNeeded(WakeUpReason aWhy,
|
|||
info.mStorageAllowed = access > nsContentUtils::StorageAccess::ePrivateBrowsing;
|
||||
info.mOriginAttributes = mInfo->GetOriginAttributes();
|
||||
|
||||
// The ServiceWorkerRegistration principal should never have any CSP
|
||||
// set. The CSP from the page that registered the SW should not be
|
||||
// inherited. Verify this is the case in non-release builds
|
||||
#if defined(DEBUG)
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
rv = info.mPrincipal->GetCsp(getter_AddRefs(csp));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
MOZ_DIAGNOSTIC_ASSERT(!csp);
|
||||
#endif
|
||||
|
||||
info.mCSP = csp;
|
||||
if (info.mCSP) {
|
||||
rv = info.mCSP->GetAllowsEval(&info.mReportCSPViolations,
|
||||
&info.mEvalAllowed);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
} else {
|
||||
info.mEvalAllowed = true;
|
||||
info.mReportCSPViolations = false;
|
||||
}
|
||||
// Default CSP permissions for now. These will be overrided if necessary
|
||||
// based on the script CSP headers during load in ScriptLoader.
|
||||
info.mEvalAllowed = true;
|
||||
info.mReportCSPViolations = false;
|
||||
|
||||
WorkerPrivate::OverrideLoadInfoLoadGroup(info);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue