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

Unified Diff: Source/core/frame/csp/ContentSecurityPolicy.cpp

Issue 563473002: CSP: Move parsing a document's CSP to DocumentLoader::responseReceived. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. 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/frame/csp/ContentSecurityPolicy.h ('k') | Source/core/loader/DocumentLoader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/csp/ContentSecurityPolicy.cpp
diff --git a/Source/core/frame/csp/ContentSecurityPolicy.cpp b/Source/core/frame/csp/ContentSecurityPolicy.cpp
index 0bd3f7c5c038533a482dffe0c185face6641e5c1..0ab6270c3c035677ce84db640178711eabcb970d 100644
--- a/Source/core/frame/csp/ContentSecurityPolicy.cpp
+++ b/Source/core/frame/csp/ContentSecurityPolicy.cpp
@@ -256,6 +256,15 @@ void ContentSecurityPolicy::setOverrideAllowInlineStyle(bool value)
m_overrideInlineStyleAllowed = value;
}
+void ContentSecurityPolicy::setOverrideURLForSelf(const KURL& url)
+{
+ // Create a temporary CSPSource so that 'self' expressions can be resolved before we bind to
+ // an execution context (for 'frame-ancestor' resolution, for example). This CSPSource will
+ // be overwritten when we bind this object to an execution context.
+ RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url);
+ m_selfSource = adoptPtr(new CSPSource(this, origin->protocol(), origin->host(), origin->port(), String(), false, false));
jochen (gone - plz use gerrit) 2014/09/11 12:49:44 bool parameters? sadness...
+}
+
const String& ContentSecurityPolicy::deprecatedHeader() const
{
return m_policies.isEmpty() ? emptyString() : m_policies[0]->header();
@@ -624,6 +633,10 @@ static void gatherSecurityPolicyViolationEventData(SecurityPolicyViolationEventI
void ContentSecurityPolicy::reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const Vector<String>& reportEndpoints, const String& header)
{
+ // FIXME: Support sending 'frame-ancestor' reports (which occur before we're bound to an execution context)
+ if (!m_executionContext)
+ return;
+
// FIXME: Support sending reports from worker.
Document* document = this->document();
if (!document)
« no previous file with comments | « Source/core/frame/csp/ContentSecurityPolicy.h ('k') | Source/core/loader/DocumentLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698