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

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

Issue 1190493002: move processContentSecurityPolicy to WorkerScriptLoader (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: (rebase) Created 5 years, 6 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/workers/WorkerScriptLoader.h ('k') | Source/core/workers/WorkerScriptLoaderClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/workers/WorkerScriptLoader.cpp
diff --git a/Source/core/workers/WorkerScriptLoader.cpp b/Source/core/workers/WorkerScriptLoader.cpp
index e86eeb591801230324d0096444ffbb2c2b29d942..7b30539fe2394cef581fe5adb8c8152f918f0853 100644
--- a/Source/core/workers/WorkerScriptLoader.cpp
+++ b/Source/core/workers/WorkerScriptLoader.cpp
@@ -33,6 +33,7 @@
#include "core/loader/WorkerThreadableLoader.h"
#include "core/workers/WorkerGlobalScope.h"
#include "core/workers/WorkerScriptLoaderClient.h"
+#include "platform/network/ContentSecurityPolicyResponseHeaders.h"
#include "platform/network/ResourceResponse.h"
#include "public/platform/WebURLRequest.h"
@@ -119,6 +120,7 @@ void WorkerScriptLoader::didReceiveResponse(unsigned long identifier, const Reso
}
m_responseURL = response.url();
m_responseEncoding = response.textEncodingName();
+ processContentSecurityPolicy(response);
if (m_client)
m_client->didReceiveResponse(identifier, response);
}
@@ -197,4 +199,13 @@ void WorkerScriptLoader::notifyFinished()
m_client->notifyFinished();
}
+void WorkerScriptLoader::processContentSecurityPolicy(const ResourceResponse& response)
+{
+ if (!response.url().protocolIs("blob") && !response.url().protocolIs("file") && !response.url().protocolIs("filesystem")) {
+ m_contentSecurityPolicy = ContentSecurityPolicy::create();
+ m_contentSecurityPolicy->setOverrideURLForSelf(response.url());
+ m_contentSecurityPolicy->didReceiveHeaders(ContentSecurityPolicyResponseHeaders(response));
+ }
+}
+
} // namespace blink
« no previous file with comments | « Source/core/workers/WorkerScriptLoader.h ('k') | Source/core/workers/WorkerScriptLoaderClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698