| 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 7b6be14df07012db9a466cba5bf8d1f89d9e452f..212b8ce74d3d96aa6f0850ae4276c97e303844a6 100644
|
| --- a/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp
|
| +++ b/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp
|
| @@ -105,6 +105,25 @@ bool CSPSource::portMatches(int port, const String& protocol) const {
|
| return false;
|
| }
|
|
|
| +bool CSPSource::subsumes(CSPSource* other) {
|
| + if (!schemeMatches(other->m_scheme))
|
| + return false;
|
| +
|
| + if (other->isSchemeOnly() || isSchemeOnly())
|
| + return isSchemeOnly();
|
| +
|
| + if ((m_hostWildcard == NoWildcard && other->m_hostWildcard == HasWildcard) ||
|
| + (m_portWildcard == NoWildcard && other->m_portWildcard == HasWildcard)) {
|
| + return false;
|
| + }
|
| +
|
| + bool hostSubsumes = (m_host == other->m_host || hostMatches(other->m_host));
|
| + bool portSubsumes = (m_portWildcard == HasWildcard) ||
|
| + portMatches(other->m_port, other->m_scheme);
|
| + bool pathSubsumes = pathMatches(other->m_path);
|
| + return hostSubsumes && portSubsumes && pathSubsumes;
|
| +}
|
| +
|
| bool CSPSource::isSchemeOnly() const {
|
| return m_host.isEmpty();
|
| }
|
|
|