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

Unified Diff: Source/core/page/ContentSecurityPolicy.cpp

Issue 14320022: Warn developers about deprecated features only once per page-load. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: OwnPtr<BitVector> -> BitVector Created 7 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 | « Source/core/page/ContentSecurityPolicy.h ('k') | Source/core/page/PageConsole.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)?";
« no previous file with comments | « Source/core/page/ContentSecurityPolicy.h ('k') | Source/core/page/PageConsole.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698