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..598c17caefe3527a8f66db3fcac13b65b36e25b5 100644 |
| --- a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp |
| +++ b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp |
| @@ -129,8 +129,12 @@ SecurityOrigin::SecurityOrigin(const KURL& url) |
| // Suborigins are serialized into the host, so extract it if necessary. |
| String suboriginName; |
| if (deserializeSuboriginAndProtocolAndHost(m_protocol, m_host, suboriginName, |
| - m_protocol, m_host)) |
| + m_protocol, m_host)) { |
| + if (!url.port()) { |
| + m_effectivePort = defaultPortForProtocol(m_protocol); |
| + } |
|
Mike West
2016/10/26 08:22:23
Nit: No {} for single-line clause.
jww
2016/10/26 16:53:00
Done.
|
| m_suborigin.setName(suboriginName); |
| + } |
| // document.domain starts as m_host, but can be set by the DOM. |
| m_domain = m_host; |
| @@ -462,9 +466,6 @@ bool SecurityOrigin::deserializeSuboriginAndProtocolAndHost( |
| String& suboriginName, |
| String& newProtocol, |
| String& newHost) { |
| - if (!RuntimeEnabledFeatures::suboriginsEnabled()) |
| - return false; |
| - |
| String originalProtocol = oldProtocol; |
| if (oldProtocol != "http-so" && oldProtocol != "https-so") |
| return false; |
| @@ -530,6 +531,16 @@ PassRefPtr<SecurityOrigin> SecurityOrigin::create(const String& protocol, |
| return create(KURL(KURL(), protocol + "://" + host + portPart + "/")); |
| } |
| +PassRefPtr<SecurityOrigin> SecurityOrigin::create(const String& protocol, |
| + const String& host, |
| + int port, |
| + const String& suborigin) { |
|
Mike West
2016/10/26 08:22:23
LGTM if you add specific tests for this new constr
jww
2016/10/26 16:53:00
Done.
|
| + RefPtr<SecurityOrigin> origin = create(protocol, host, port); |
| + if (!suborigin.isEmpty()) |
| + origin->m_suborigin.setName(suborigin); |
| + return origin.release(); |
| +} |
| + |
| bool SecurityOrigin::isSameSchemeHostPort(const SecurityOrigin* other) const { |
| if (this == other) |
| return true; |