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

Unified Diff: third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp

Issue 2805673002: CSP: 'strict-dynamic' should allow 'new Worker()' (Closed)
Patch Set: Fix the test. Created 3 years, 8 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 | « third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
index 6a1e4bc6a5671ce07de0bd72fa94dbdd849d17f4..6afd03c976f03db12565c2ea4d7ea9d1b196fd51 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
@@ -802,12 +802,12 @@ bool CSPDirectiveList::allowWorkerFromSource(
const KURL& url,
ResourceRequest::RedirectStatus redirectStatus,
SecurityViolationReportingPolicy reportingPolicy) const {
- // sources. So, we do this nested set of calls to 'operativeDirective()' to
- // grab 'worker-src' if it exists, 'script-src' if it doesn't, and
- // 'defaut-src' if neither are available.
SourceListDirective* workerSrc = operativeDirective(
m_workerSrc.get(), operativeDirective(m_scriptSrc.get()));
+ if (allowDynamicWorker())
+ return true;
+
// In CSP2, workers are controlled via 'child-src'. CSP3 moves them to
// 'script-src'. In order to avoid breaking sites that allowed workers via
// 'child-src' that would have been blocked via 'script-src', we'll
@@ -875,6 +875,12 @@ bool CSPDirectiveList::allowDynamic() const {
return checkDynamic(operativeDirective(m_scriptSrc.get()));
}
+bool CSPDirectiveList::allowDynamicWorker() const {
+ SourceListDirective* workerSrc = operativeDirective(
+ m_workerSrc.get(), operativeDirective(m_scriptSrc.get()));
+ return checkDynamic(workerSrc);
+}
+
const String& CSPDirectiveList::pluginTypesText() const {
ASSERT(hasPluginTypes());
return m_pluginTypes->text();
« no previous file with comments | « third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698