diff options
Diffstat (limited to 'Source/WebCore/page/OriginAccessEntry.cpp')
-rw-r--r-- | Source/WebCore/page/OriginAccessEntry.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Source/WebCore/page/OriginAccessEntry.cpp b/Source/WebCore/page/OriginAccessEntry.cpp index 7ff67cc46..8472d38eb 100644 --- a/Source/WebCore/page/OriginAccessEntry.cpp +++ b/Source/WebCore/page/OriginAccessEntry.cpp @@ -35,10 +35,11 @@ namespace WebCore { -OriginAccessEntry::OriginAccessEntry(const String& protocol, const String& host, SubdomainSetting subdomainSetting) - : m_protocol(protocol.lower()) - , m_host(host.lower()) +OriginAccessEntry::OriginAccessEntry(const String& protocol, const String& host, SubdomainSetting subdomainSetting, IPAddressSetting ipAddressSetting) + : m_protocol(protocol.convertToASCIILowercase()) + , m_host(host.convertToASCIILowercase()) , m_subdomainSettings(subdomainSetting) + , m_ipAddressSettings(ipAddressSetting) { ASSERT(subdomainSetting == AllowSubdomains || subdomainSetting == DisallowSubdomains); @@ -48,8 +49,8 @@ OriginAccessEntry::OriginAccessEntry(const String& protocol, const String& host, bool OriginAccessEntry::matchesOrigin(const SecurityOrigin& origin) const { - ASSERT(origin.host() == origin.host().lower()); - ASSERT(origin.protocol() == origin.protocol().lower()); + ASSERT(origin.host() == origin.host().convertToASCIILowercase()); + ASSERT(origin.protocol() == origin.protocol().convertToASCIILowercase()); if (m_protocol != origin.protocol()) return false; @@ -65,9 +66,10 @@ bool OriginAccessEntry::matchesOrigin(const SecurityOrigin& origin) const // Otherwise we can only match if we're matching subdomains. if (m_subdomainSettings == DisallowSubdomains) return false; - + + // IP addresses are not domains: https://url.spec.whatwg.org/#concept-domain // Don't try to do subdomain matching on IP addresses. - if (m_hostIsIPAddress) + if (m_hostIsIPAddress && m_ipAddressSettings == TreatIPAddressAsIPAddress) return false; // Match subdomains. |