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

Unified Diff: third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h

Issue 2474903002: Part 3.1: Is policy list subsumed under subsuming policy? (Closed)
Patch Set: Rebasing on enums changes Created 4 years, 1 month 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: third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h
index 51ab571882a0465373623897c3833e542941dbc1..e9aeef2a87b294cdfed4de3e8240cb90dfa142ce 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h
+++ b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h
@@ -22,6 +22,8 @@ namespace blink {
class ContentSecurityPolicy;
+typedef HeapVector<Member<SourceListDirective>> SourceListDirectiveVector;
+
class CORE_EXPORT CSPDirectiveList
: public GarbageCollectedFinalized<CSPDirectiveList> {
WTF_MAKE_NONCOPYABLE(CSPDirectiveList);
@@ -156,10 +158,15 @@ class CORE_EXPORT CSPDirectiveList
bool shouldSendCSPHeader(Resource::Type) const;
+ // The algorithm is described here:
+ // https://w3c.github.io/webappsec-csp/embedded/#subsume-policy
+ bool subsumes(CSPDirectiveListVector);
+
DECLARE_TRACE();
private:
FRIEND_TEST_ALL_PREFIXES(CSPDirectiveListTest, IsMatchingNoncePresent);
+ FRIEND_TEST_ALL_PREFIXES(CSPDirectiveListTest, GetSourceVector);
enum RequireSRIForToken { None = 0, Script = 1 << 0, Style = 1 << 1 };
@@ -266,6 +273,12 @@ class CORE_EXPORT CSPDirectiveList
bool denyIfEnforcingPolicy() const { return isReportOnly(); }
+ SourceListDirective* operativeDirective(
Mike West 2016/11/24 13:07:46 Please add unit tests, especially for the cascade
amalika 2016/11/24 14:32:29 Added!
+ const ContentSecurityPolicy::DirectiveType&);
+ static SourceListDirectiveVector getSourceVector(
Mike West 2016/11/24 13:07:46 Can you add a comment explaining what these functi
amalika 2016/11/24 14:32:29 Added!
+ const ContentSecurityPolicy::DirectiveType&,
+ CSPDirectiveListVector policies);
+
Member<ContentSecurityPolicy> m_policy;
String m_header;

Powered by Google App Engine
This is Rietveld 408576698