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

Unified Diff: third_party/WebKit/Source/core/workers/AbstractWorker.cpp

Issue 2056183002: Implement the `require-sri-for` CSP directive (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated tests Created 4 years, 5 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
Index: third_party/WebKit/Source/core/workers/AbstractWorker.cpp
diff --git a/third_party/WebKit/Source/core/workers/AbstractWorker.cpp b/third_party/WebKit/Source/core/workers/AbstractWorker.cpp
index 3f669f800776697f26113c94755b53054a328273..0632b186d039ea2a5116b0bb2c7e7d84f511c322 100644
--- a/third_party/WebKit/Source/core/workers/AbstractWorker.cpp
+++ b/third_party/WebKit/Source/core/workers/AbstractWorker.cpp
@@ -47,7 +47,7 @@ AbstractWorker::~AbstractWorker()
{
}
-KURL AbstractWorker::resolveURL(const String& url, ExceptionState& exceptionState)
+KURL AbstractWorker::resolveURL(const String& url, ExceptionState& exceptionState, WebURLRequest::RequestContext requestContext)
{
// FIXME: This should use the dynamic global scope (bug #27887)
KURL scriptURL = getExecutionContext()->completeURL(url);
@@ -62,7 +62,9 @@ KURL AbstractWorker::resolveURL(const String& url, ExceptionState& exceptionStat
return KURL();
}
- if (getExecutionContext()->contentSecurityPolicy() && !getExecutionContext()->contentSecurityPolicy()->allowWorkerContextFromSource(scriptURL)) {
+ if (getExecutionContext()->contentSecurityPolicy()
+ && !(getExecutionContext()->contentSecurityPolicy()->allowRequestWithoutIntegrity(requestContext, scriptURL)
+ && getExecutionContext()->contentSecurityPolicy()->allowWorkerContextFromSource(scriptURL))) {
exceptionState.throwSecurityError("Access to the script at '" + scriptURL.elidedString() + "' is denied by the document's Content Security Policy.");
return KURL();
}

Powered by Google App Engine
This is Rietveld 408576698