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

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

Issue 2644633006: Add KURL::protocolIsJavascript member function (Closed)
Patch Set: Created 3 years, 11 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/KURL.h ('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/KURL.cpp
diff --git a/third_party/WebKit/Source/platform/weborigin/KURL.cpp b/third_party/WebKit/Source/platform/weborigin/KURL.cpp
index c81f2d3a3eff09c385138a0a2d350b98e191248b..dddb316f098d21d8fdcd2795f9a8aa0619b7b76f 100644
--- a/third_party/WebKit/Source/platform/weborigin/KURL.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/KURL.cpp
@@ -305,6 +305,10 @@ bool KURL::hasPort() const {
return hostEnd() < pathStart();
}
+bool KURL::protocolIsJavaScript() const {
+ return componentStringView(m_parsed.scheme) == "javascript";
+}
+
bool KURL::protocolIsInHTTPFamily() const {
return m_protocolIsInHTTPFamily;
}
@@ -778,6 +782,7 @@ void KURL::init(const KURL& base,
initProtocolMetadata();
initInnerURL();
+ DCHECK(!::blink::protocolIsJavaScript(m_string) || protocolIsJavaScript());
}
void KURL::initInnerURL() {
@@ -828,7 +833,7 @@ bool KURL::protocolIs(const char* protocol) const {
}
StringView KURL::stringViewForInvalidComponent() const {
- return m_string.isNull() ? StringView() : StringView("", 0);
+ return m_string.isNull() ? StringView() : StringView(StringImpl::empty());
}
StringView KURL::componentStringView(const url::Component& component) const {
« no previous file with comments | « third_party/WebKit/Source/platform/weborigin/KURL.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698