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

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

Issue 2487983003: Part 2.3: Is policy list subsumed under subsuming policy? (Closed)
Patch Set: Separating scheme to scheme normalization 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/CSPSource.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp b/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp
index 0d2dfe1a4f3665f150cde6ff3d3be7004ab91d68..631fd5a8041536ecb08ce028c42ee86379506121 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp
@@ -145,6 +145,13 @@ CSPSource* CSPSource::intersect(CSPSource* other) {
return nullptr;
String scheme = other->schemeMatches(m_scheme) ? m_scheme : other->m_scheme;
+ if (isSchemeOnly() || other->isSchemeOnly()) {
+ CSPSource* stricter = isSchemeOnly() ? other : this;
+ return new CSPSource(m_policy, scheme, stricter->m_host, stricter->m_port,
+ stricter->m_path, stricter->m_hostWildcard,
+ stricter->m_portWildcard);
+ }
+
String host = m_hostWildcard == NoWildcard ? m_host : other->m_host;
String path = other->pathMatches(m_path) ? m_path : other->m_path;
int port = (other->m_portWildcard == HasWildcard || !other->m_port)
@@ -162,6 +169,14 @@ bool CSPSource::isSchemeOnly() const {
return m_host.isEmpty();
}
+void CSPSource::addToMap(HashMap<String, CSPSource*>& hashMap) {
+ hashMap.add(m_scheme, this);
+ if (m_scheme == "http")
+ hashMap.add("https", this);
+ else if (m_scheme == "ws")
+ hashMap.add("wss", this);
+}
+
DEFINE_TRACE(CSPSource) {
visitor->trace(m_policy);
}

Powered by Google App Engine
This is Rietveld 408576698