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); |
} |