Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Unified Diff: third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp

Issue 2449233002: Add suborigins to WebSecurityOrigin (Closed)
Patch Set: Rebase on ToT Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..d740bb4a282c48a9bf1c66fc56c5ed7a67b657c0 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);
+
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) {
+ 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;

Powered by Google App Engine
This is Rietveld 408576698