From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/page/OriginAccessEntry.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'Source/WebCore/page/OriginAccessEntry.cpp') 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. -- cgit v1.2.1