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

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

Issue 21789002: CSP: Deduplicate violation reports before sending. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: tests. Created 7 years, 4 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: Source/core/page/ContentSecurityPolicy.h
diff --git a/Source/core/page/ContentSecurityPolicy.h b/Source/core/page/ContentSecurityPolicy.h
index 444455fd25b2cbb1fbb1a719558b63113835e701..13f007ffa1d59162f20eb5d37e7c9d44583ffd34 100644
--- a/Source/core/page/ContentSecurityPolicy.h
+++ b/Source/core/page/ContentSecurityPolicy.h
@@ -27,8 +27,10 @@
#define ContentSecurityPolicy_h
#include "bindings/v8/ScriptState.h"
+#include "wtf/HashSet.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/Vector.h"
+#include "wtf/text/StringHash.h"
#include "wtf/text/TextPosition.h"
#include "wtf/text/WTFString.h"
@@ -41,6 +43,7 @@ namespace WebCore {
class ContentSecurityPolicyResponseHeaders;
class CSPDirectiveList;
class DOMStringList;
+class JSONObject;
class KURL;
class ScriptExecutionContext;
class SecurityOrigin;
@@ -125,7 +128,7 @@ public:
void reportInvalidReflectedXSS(const String&) const;
void reportMissingReportURI(const String&) const;
void reportUnsupportedDirective(const String&) const;
- void reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const Vector<KURL>& reportURIs, const String& header, const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), ScriptState* = 0) const;
+ void reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const Vector<KURL>& reportURIs, const String& header, const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), ScriptState* = 0);
void reportBlockedScriptExecutionToInspector(const String& directiveText) const;
@@ -145,9 +148,14 @@ private:
void logToConsole(const String& message, const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), ScriptState* = 0) const;
void addPolicyFromHeaderValue(const String&, HeaderType);
+ bool shouldSendViolationReport(const String&) const;
+ void didSendViolationReport(const String&);
+
ScriptExecutionContext* m_scriptExecutionContext;
bool m_overrideInlineStyleAllowed;
CSPDirectiveListVector m_policies;
+
+ HashSet<unsigned, AlreadyHashed> m_violationReportsSent;
};
}

Powered by Google App Engine
This is Rietveld 408576698