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 |