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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContentsClient.java

Issue 144283007: Call WebViewClient#onPageFinished when a main frame fails to load (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments about the test Created 6 years, 10 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 | android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
index e3876cd2bd4c39105ab8d41b701914bf9b850078..22e7c7dacbfd1c80ddb2d5e572fb0ef2a8a03a2a 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
@@ -58,28 +58,30 @@ public abstract class AwContentsClient {
@Override
public void didFinishLoad(long frameId, String validatedUrl, boolean isMainFrame) {
- if (isMainFrame)
+ if (isMainFrame) {
AwContentsClient.this.onPageFinished(validatedUrl);
+ }
}
@Override
public void didFailLoad(boolean isProvisionalLoad,
boolean isMainFrame, int errorCode, String description, String failingUrl) {
- if (errorCode == NetError.ERR_ABORTED) {
- // This error code is generated for the following reasons:
- // - WebView.stopLoading is called,
- // - the navigation is intercepted by the embedder via shouldOverrideNavigation.
- //
- // The Android WebView does not notify the embedder of these situations using this
- // error code with the WebViewClient.onReceivedError callback.
- return;
- }
- if (!isMainFrame) {
- // The Android WebView does not notify the embedder of sub-frame failures.
- return;
+ if (isMainFrame) {
+ if (errorCode != NetError.ERR_ABORTED) {
+ // This error code is generated for the following reasons:
+ // - WebView.stopLoading is called,
+ // - the navigation is intercepted by the embedder via shouldOverrideNavigation.
+ //
+ // The Android WebView does not notify the embedder of these situations using
+ // this error code with the WebViewClient.onReceivedError callback.
+ AwContentsClient.this.onReceivedError(
+ ErrorCodeConversionHelper.convertErrorCode(errorCode), description,
+ failingUrl);
+ }
+ // Need to call onPageFinished after onReceivedError (if there is an error) for
+ // backwards compatibility with the classic webview.
+ AwContentsClient.this.onPageFinished(failingUrl);
}
- AwContentsClient.this.onReceivedError(
- ErrorCodeConversionHelper.convertErrorCode(errorCode), description, failingUrl);
}
@Override
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698