Commit 809126fe authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

weblayer: fix url matching

WEB_URL matches strings that don't contain a scheme. We should only
use WEB_URL if the matched url has a sheme. To return a relative url
results in using about:blank.

BUG=1134608
TEST=none

Change-Id: I1f4e6a5c3439ad0677aa7279dec316e839fcb61e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2445911Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813230}
parent 0b1b3ddd
......@@ -656,7 +656,10 @@ public class WebLayerShellActivity extends AppCompatActivity {
// testing where a port is remapped.
// Use WEB_URL first to ensure this matches urls such as 'https.'
if (WEB_URL.matcher(input).matches() || input.startsWith("http://localhost:")) {
return Uri.parse(input);
// WEB_URL matches relative urls (relative meaning no scheme), but this branch is only
// interested in absolute urls. Fall through if no scheme is supplied.
Uri uri = Uri.parse(input);
if (!uri.isRelative()) return uri;
}
if (input.startsWith("www.") || input.indexOf(":") == -1) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment