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

Unified Diff: Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp

Issue 133273030: Change a WebString type of url parameter with WebURL (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 | « no previous file | Source/modules/navigatorcontentutils/NavigatorContentUtilsClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
diff --git a/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp b/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
index 745b902179d042dbc1148c4bcda874e6feb5896a..09e24dfc2181348ee8fdce49815bca9263820090 100644
--- a/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
+++ b/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp
@@ -67,7 +67,7 @@ static void initProtocolHandlerWhitelist()
protocolWhitelist->add(protocols[i]);
}
-static bool verifyCustomHandlerURL(const String& baseURL, const String& url, ExceptionState& exceptionState)
+static bool verifyCustomHandlerURL(const KURL& baseURL, const String& url, ExceptionState& exceptionState)
{
// The specification requires that it is a SyntaxError if the "%s" token is
// not present.
@@ -83,11 +83,10 @@ static bool verifyCustomHandlerURL(const String& baseURL, const String& url, Exc
String newURL = url;
newURL.remove(index, WTF_ARRAY_LENGTH(token) - 1);
- KURL base(ParsedURLString, baseURL);
- KURL kurl(base, newURL);
+ KURL kurl(baseURL, newURL);
if (kurl.isEmpty() || !kurl.isValid()) {
- exceptionState.throwDOMException(SyntaxError, "The custom handler URL created by removing '%s' and prepending '" + baseURL + "' is invalid.");
+ exceptionState.throwDOMException(SyntaxError, "The custom handler URL created by removing '%s' and prepending '" + baseURL.string() + "' is invalid.");
return false;
}
@@ -143,7 +142,7 @@ void NavigatorContentUtils::registerProtocolHandler(Navigator* navigator, const
if (!document)
return;
- String baseURL = document->baseURL().baseAsString();
+ KURL baseURL = document->baseURL();
if (!verifyCustomHandlerURL(baseURL, url, exceptionState))
return;
@@ -151,7 +150,7 @@ void NavigatorContentUtils::registerProtocolHandler(Navigator* navigator, const
if (!verifyProtocolHandlerScheme(scheme, "registerProtocolHandler", exceptionState))
return;
- NavigatorContentUtils::from(navigator->frame()->page())->client()->registerProtocolHandler(scheme, baseURL, url, title);
+ NavigatorContentUtils::from(navigator->frame()->page())->client()->registerProtocolHandler(scheme, baseURL, KURL(ParsedURLString, url), title);
}
static String customHandlersStateString(const NavigatorContentUtilsClient::CustomHandlersState state)
@@ -181,7 +180,7 @@ String NavigatorContentUtils::isProtocolHandlerRegistered(Navigator* navigator,
return declined;
Document* document = navigator->frame()->document();
- String baseURL = document->baseURL().baseAsString();
+ KURL baseURL = document->baseURL();
if (!verifyCustomHandlerURL(baseURL, url, exceptionState))
return declined;
@@ -189,7 +188,7 @@ String NavigatorContentUtils::isProtocolHandlerRegistered(Navigator* navigator,
if (!verifyProtocolHandlerScheme(scheme, "isProtocolHandlerRegistered", exceptionState))
return declined;
- return customHandlersStateString(NavigatorContentUtils::from(navigator->frame()->page())->client()->isProtocolHandlerRegistered(scheme, baseURL, url));
+ return customHandlersStateString(NavigatorContentUtils::from(navigator->frame()->page())->client()->isProtocolHandlerRegistered(scheme, baseURL, KURL(ParsedURLString, url)));
}
void NavigatorContentUtils::unregisterProtocolHandler(Navigator* navigator, const String& scheme, const String& url, ExceptionState& exceptionState)
@@ -198,7 +197,7 @@ void NavigatorContentUtils::unregisterProtocolHandler(Navigator* navigator, cons
return;
Document* document = navigator->frame()->document();
- String baseURL = document->baseURL().baseAsString();
+ KURL baseURL = document->baseURL();
if (!verifyCustomHandlerURL(baseURL, url, exceptionState))
return;
@@ -206,7 +205,7 @@ void NavigatorContentUtils::unregisterProtocolHandler(Navigator* navigator, cons
if (!verifyProtocolHandlerScheme(scheme, "unregisterProtocolHandler", exceptionState))
return;
- NavigatorContentUtils::from(navigator->frame()->page())->client()->unregisterProtocolHandler(scheme, baseURL, url);
+ NavigatorContentUtils::from(navigator->frame()->page())->client()->unregisterProtocolHandler(scheme, baseURL, KURL(ParsedURLString, url));
}
const char* NavigatorContentUtils::supplementName()
« no previous file with comments | « no previous file | Source/modules/navigatorcontentutils/NavigatorContentUtilsClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698