summaryrefslogtreecommitdiff
path: root/Source/WebCore/page/OriginAccessEntry.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/page/OriginAccessEntry.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/page/OriginAccessEntry.cpp')
-rw-r--r--Source/WebCore/page/OriginAccessEntry.cpp16
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.