Index: android_webview/tools/system_webview_shell/apk/src/org/chromium/webview_shell/WebViewBrowserActivity.java |
diff --git a/android_webview/tools/system_webview_shell/apk/src/org/chromium/webview_shell/WebViewBrowserActivity.java b/android_webview/tools/system_webview_shell/apk/src/org/chromium/webview_shell/WebViewBrowserActivity.java |
index c8b3ae75e7903f68545beb872fadb7dad0d1a847..02b364a67d855f11348820e34877978fc6f9581b 100644 |
--- a/android_webview/tools/system_webview_shell/apk/src/org/chromium/webview_shell/WebViewBrowserActivity.java |
+++ b/android_webview/tools/system_webview_shell/apk/src/org/chromium/webview_shell/WebViewBrowserActivity.java |
@@ -50,9 +50,6 @@ import org.chromium.base.Log; |
import java.lang.reflect.InvocationTargetException; |
import java.lang.reflect.Method; |
-import java.net.URI; |
-import java.net.URISyntaxException; |
- |
import java.util.ArrayList; |
import java.util.HashMap; |
import java.util.List; |
@@ -401,16 +398,10 @@ public class WebViewBrowserActivity extends Activity implements PopupMenu.OnMenu |
public void loadUrlFromUrlBar(View view) { |
String url = mUrlBar.getText().toString(); |
- try { |
- URI uri = new URI(url); |
- url = (uri.getScheme() == null) ? "http://" + uri.toString() : uri.toString(); |
- } catch (URISyntaxException e) { |
- String message = "<html><body>URISyntaxException: " + e.getMessage() + "</body></html>"; |
- mWebView.loadData(message, "text/html", "UTF-8"); |
- setUrlFail(true); |
- return; |
- } |
- |
+ // Parse with android.net.Uri instead of java.net.URI because Uri does no validation. Rather |
+ // than failing, illegal characters should just be passed through to WebView, which will |
+ // escape them where appropriate. |
+ if (Uri.parse(url).getScheme() == null) url = "http://" + url; |
timvolodine
2017/02/02 01:32:35
I think the original code also meant to catch thin
paulmiller
2017/02/02 01:43:20
No, but I don't think we need to. If you give WebV
|
setUrlBarText(url); |
setUrlFail(false); |
loadUrl(url); |