Index: Source/core/page/ContentSecurityPolicy.cpp |
diff --git a/Source/core/page/ContentSecurityPolicy.cpp b/Source/core/page/ContentSecurityPolicy.cpp |
index 6a4fb5a5ee8ae872842e306dc2e6d8a455da6f58..beae22d7fc01eeb9e28f803d35b8c005279b4721 100644 |
--- a/Source/core/page/ContentSecurityPolicy.cpp |
+++ b/Source/core/page/ContentSecurityPolicy.cpp |
@@ -36,6 +36,7 @@ |
#include "InspectorInstrumentation.h" |
#include "InspectorValues.h" |
#include "KURL.h" |
+#include "PageConsole.h" |
#include "PingLoader.h" |
#include "RuntimeEnabledFeatures.h" |
#include "SchemeRegistry.h" |
@@ -1457,12 +1458,11 @@ void ContentSecurityPolicy::didReceiveHeader(const String& header, HeaderType ty |
{ |
if (m_scriptExecutionContext->isDocument()) { |
Document* document = toDocument(m_scriptExecutionContext); |
- if (document->domWindow()) |
- UseCounter::observe(document->domWindow(), getUseCounterType(type)); |
- } |
+ UseCounter::observe(document, getUseCounterType(type)); |
- if (type == PrefixedReport || type == PrefixedEnforce) |
- reportDeprecatedHeader(type); |
+ if (type == PrefixedReport || type == PrefixedEnforce) |
+ PageConsole::reportDeprecation(document, PageConsole::PrefixedContentSecurityPolicyHeader); |
+ } |
// RFC2616, section 4.2 specifies that headers appearing multiple times can |
// be combined with a comma. Walk the header string, and parse each comma |
@@ -1804,12 +1804,6 @@ void ContentSecurityPolicy::reportUnsupportedDirective(const String& name) const |
logToConsole(message); |
} |
-void ContentSecurityPolicy::reportDeprecatedHeader(HeaderType type) const |
-{ |
- ASSERT(type == PrefixedEnforce || type == PrefixedReport); |
- logToConsole(makeString("The '", type == PrefixedEnforce ? "X-WebKit-CSP" : "X-WebKit-CSP-Report-Only", "' header is deprecated. Please consider using the unprefixed '", type == PrefixedEnforce ? "Content-Security-Policy" : "Content-Security-Policy-Report-Only", "' header instead.")); |
-} |
- |
void ContentSecurityPolicy::reportDirectiveAsSourceExpression(const String& directiveName, const String& sourceExpression) const |
{ |
String message = "The Content Security Policy directive '" + directiveName + "' contains '" + sourceExpression + "' as a source expression. Did you mean '" + directiveName + " ...; " + sourceExpression + "...' (note the semicolon)?"; |