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

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

Issue 2442513004: Part 1.1: Is policy list subsumed under subsuming policy? (Closed)
Patch Set: More tests, separating methods Created 4 years, 2 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 | « no previous file | third_party/WebKit/Source/core/frame/csp/CSPSource.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/csp/CSPSource.h
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPSource.h b/third_party/WebKit/Source/core/frame/csp/CSPSource.h
index 8b4f56a8cd2dd52cc361c3fa09aca2de1441474c..b15695222e44f06b606878beb0868751bf8471d4 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPSource.h
+++ b/third_party/WebKit/Source/core/frame/csp/CSPSource.h
@@ -31,15 +31,34 @@ class CORE_EXPORT CSPSource : public GarbageCollectedFinalized<CSPSource> {
bool matches(const KURL&,
ResourceRequest::RedirectStatus =
ResourceRequest::RedirectStatus::NoRedirect) const;
+ // Check whether this CSPSource is subsumed under a given CSPSource for a
+ // subsumption algorithm described here:
+ // https://w3c.github.io/webappsec-csp/embedded/#subsume-policy
+ bool isSubsumedBy(CSPSource*);
+ // Retrieve the most common information from the two CSPSources if isSimilar
+ // is true for the two. Otherwise, return nullptr.
+ CSPSource* getCommon(CSPSource*);
DECLARE_TRACE();
private:
+ FRIEND_TEST_ALL_PREFIXES(CSPSourceTest, IsSimilar);
+
bool schemeMatches(const String&) const;
bool hostMatches(const String&) const;
bool pathMatches(const String&) const;
bool portMatches(int, const String&) const;
bool isSchemeOnly() const;
+ bool isPathEmptyOrSlashOnly() const;
+ // Check if either one of the two matches the scheme, host, port, path of the
+ // other. More detailed explanation here:
+ // https://docs.google.com/document/d/1xwTxpB_sWYaTrOBJEPSXtfWKO4M2k9Xya7o0zcd6Dec/edit#heading=h.9efhej5pg0hj
Mike West 2016/11/04 09:48:10 1. This needs to be a publicly accessible link. `g
+ bool isSimilar(CSPSource* other);
+
+ bool isWildcardsSubsumedBy(CSPSource* other);
+ bool isSchemeSubsumedBy(CSPSource* other);
+ bool isPortSubsumedBy(CSPSource* other);
+ bool isPathSubsumedBy(CSPSource* other);
Member<ContentSecurityPolicy> m_policy;
String m_scheme;
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/csp/CSPSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698