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

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

Issue 1001003004: [Android WebView] Implement a better OnReceivedError callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed the last comment Created 5 years, 9 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
Index: android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java b/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
index a248d3988c34e9ec14d88fc49546ba0ab8e4d166..f985369e29e2eb195163db7f9069bd24197fa6fc 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
@@ -51,29 +51,9 @@ public class AwWebContentsObserver extends WebContentsObserver {
String unreachableWebDataUrl = AwContentsStatics.getUnreachableWebDataUrl();
boolean isErrorUrl =
unreachableWebDataUrl != null && unreachableWebDataUrl.equals(failingUrl);
- if (isErrorUrl) return;
- 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.AwWebResourceRequest request =
- new AwContentsClient.AwWebResourceRequest();
- request.url = failingUrl;
- request.isMainFrame = isMainFrame;
- // TODO(mnaganov): Fill in the rest of AwWebResourceRequest fields. Probably,
- // we will have to actually invoke the error callback from the network delegate
- // in order to catch load errors for all resources.
- AwContentsClient.AwWebResourceError error = new AwContentsClient.AwWebResourceError();
- error.errorCode = ErrorCodeConversionHelper.convertErrorCode(errorCode);
- error.description = description;
- mAwContentsClient.onReceivedError(request, error);
- }
- if (isMainFrame) {
- // Need to call onPageFinished after onReceivedError (if there is an error) for
- // backwards compatibility with the classic webview.
+ if (isMainFrame && !isErrorUrl && errorCode == NetError.ERR_ABORTED) {
+ // Need to call onPageFinished for backwards compatibility with the classic webview.
+ // See also AwContents.IoThreadClientImpl.onReceivedError.
mAwContentsClient.onPageFinished(failingUrl);
}
}

Powered by Google App Engine
This is Rietveld 408576698