Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1896)

Unified Diff: Source/core/workers/WorkerGlobalScope.cpp

Issue 559503002: CSP: Move policy parsing out of Document. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reworking. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | Source/core/xml/XSLTProcessor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/workers/WorkerGlobalScope.cpp
diff --git a/Source/core/workers/WorkerGlobalScope.cpp b/Source/core/workers/WorkerGlobalScope.cpp
index 42a5da82d953788966b4210b54d52fe8f9671b57..631b3dc98124d0b1e3cdf16f4a1a25aa83d98293 100644
--- a/Source/core/workers/WorkerGlobalScope.cpp
+++ b/Source/core/workers/WorkerGlobalScope.cpp
@@ -103,8 +103,11 @@ WorkerGlobalScope::~WorkerGlobalScope()
void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& policy, ContentSecurityPolicyHeaderType contentSecurityPolicyType)
{
- setContentSecurityPolicy(ContentSecurityPolicy::create(this));
- contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType, ContentSecurityPolicyHeaderSourceHTTP);
+ // FIXME: This doesn't match the CSP2 spec's Worker behavior (see https://w3c.github.io/webappsec/specs/content-security-policy/#processing-model-workers)
+ RefPtr<ContentSecurityPolicy> csp = ContentSecurityPolicy::create();
+ csp->didReceiveHeader(policy, contentSecurityPolicyType, ContentSecurityPolicyHeaderSourceHTTP);
+ csp->bindToExecutionContext(executionContext());
+ setContentSecurityPolicy(csp);
}
ExecutionContext* WorkerGlobalScope::executionContext() const
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | Source/core/xml/XSLTProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698