Commit 941617af authored by Hazem Ashmawy's avatar Hazem Ashmawy Committed by Commit Bot

[aw] Early return in loadUrl

loadUrl(String) has an early return if url == null, this is just adding the same early return to loadUrl(String, Map<String,String>). This should prevent sending null values to AwContents::SetExtraHeadersForUrl and then to ConvertJavaStringToUTF8.

Bug: 864708
Change-Id: If169dbc89dfdf745e7fa27921fa7624abed40a84
Reviewed-on: https://chromium-review.googlesource.com/c/1283449Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Commit-Queue: Hazem Ashmawy <hazems@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600338}
parent 5d2271ca
......@@ -1576,6 +1576,10 @@ public class AwContents implements SmartClipProvider {
public void loadUrl(String url, Map<String, String> additionalHttpHeaders) {
if (TRACE) Log.i(TAG, "%s loadUrl(extra headers)=%s", this, url);
if (isDestroyedOrNoOperation(WARN)) return;
// Early out to match old WebView implementation
if (url == null) {
return;
}
// TODO: We may actually want to do some sanity checks here (like filter about://chrome).
// For backwards compatibility, apps targeting less than K will have JS URLs evaluated
......@@ -1583,8 +1587,7 @@ public class AwContents implements SmartClipProvider {
// Matching Chrome behavior more closely; apps targetting >= K that load a JS URL will
// have the result of that URL replace the content of the current page.
final String javaScriptScheme = "javascript:";
if (mAppTargetSdkVersion < Build.VERSION_CODES.KITKAT && url != null
&& url.startsWith(javaScriptScheme)) {
if (mAppTargetSdkVersion < Build.VERSION_CODES.KITKAT && url.startsWith(javaScriptScheme)) {
evaluateJavaScript(url.substring(javaScriptScheme.length()), null);
return;
}
......@@ -1595,7 +1598,7 @@ public class AwContents implements SmartClipProvider {
}
final String dataScheme = "data:";
if (url != null && url.startsWith(dataScheme) && url.contains("#")) {
if (url.startsWith(dataScheme) && url.contains("#")) {
RecordHistogram.recordBooleanHistogram(DATA_URI_HISTOGRAM_NAME, true);
}
......
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