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

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

Issue 2447293002: Don't call lower() on KURL protocol/host (Closed)
Patch Set: dont call protocol() / host() twice in SecurityOrigin constructor 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
« no previous file with comments | « third_party/WebKit/Source/platform/weborigin/KnownPorts.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « third_party/WebKit/Source/platform/weborigin/KnownPorts.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698