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..1c6f972e6af395a913ab29247b5dba2db78cfaff 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 in the browser, let WebView handle weird URLs. WebView will escape illegal |
+ // characters and display error pages for bad URLs like "blah://example.com". |
+ if (Uri.parse(url).getScheme() == null) url = "http://" + url; |
setUrlBarText(url); |
setUrlFail(false); |
loadUrl(url); |