Chromium Code Reviews| Index: third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp |
| diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp |
| index 0864fb2effcaedb0cfae82fa01314a5861b9de23..b567ce3ffbb925e931df3c9454c768b32d2a5fcd 100644 |
| --- a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp |
| +++ b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp |
| @@ -103,11 +103,7 @@ static bool shouldTreatAsUniqueOrigin(const KURL& url) { |
| (relevantURL.protocolIsInHTTPFamily() || relevantURL.protocolIs("ftp")) && |
| relevantURL.host().isEmpty())); |
| - // SchemeRegistry needs a lower case protocol because it uses HashMaps |
| - // that assume the scheme has already been canonicalized. |
| - String protocol = relevantURL.protocol().lower(); |
| - |
| - if (SchemeRegistry::shouldTreatURLSchemeAsNoAccess(protocol)) |
| + if (SchemeRegistry::shouldTreatURLSchemeAsNoAccess(relevantURL.protocol())) |
| return true; |
| // This is the common case. |
| @@ -115,9 +111,8 @@ static bool shouldTreatAsUniqueOrigin(const KURL& url) { |
| } |
| SecurityOrigin::SecurityOrigin(const KURL& url) |
| - : m_protocol(url.protocol().isNull() ? emptyString() |
| - : url.protocol().lower()), |
| - m_host(url.host().isNull() ? emptyString() : url.host().lower()), |
| + : m_protocol(url.protocol()), |
| + m_host(url.host().lower()), |
|
brettw
2016/10/26 01:54:27
Since you're here, you can delete this lower() cal
Charlie Harrison
2016/10/26 01:58:32
Actually, I tried that and hit a DCHECK failure in
|
| m_port(url.port()), |
| m_effectivePort(url.port() ? url.port() |
| : defaultPortForProtocol(m_protocol)), |
| @@ -126,6 +121,11 @@ SecurityOrigin::SecurityOrigin(const KURL& url) |
| m_domainWasSetInDOM(false), |
| m_blockLocalAccessFromLocalOrigin(false), |
| m_isUniqueOriginPotentiallyTrustworthy(false) { |
| + if (m_protocol.isNull()) |
| + m_protocol = emptyString(); |
| + if (m_host.isNull()) |
| + m_host = emptyString(); |
| + |
| // Suborigins are serialized into the host, so extract it if necessary. |
| String suboriginName; |
| if (deserializeSuboriginAndProtocolAndHost(m_protocol, m_host, suboriginName, |
| @@ -320,8 +320,7 @@ bool SecurityOrigin::canDisplay(const KURL& url) const { |
| if (m_universalAccess) |
| return true; |
| - String protocol = url.protocol().lower(); |
| - |
| + String protocol = url.protocol(); |
| if (SchemeRegistry::canDisplayOnlyIfCanRequest(protocol)) |
| return canRequest(url); |