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

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: Restored empty line 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..4746aa95eafc535c097c069b532c065f9070039d 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwWebContentsObserver.java
@@ -8,7 +8,6 @@ import org.chromium.android_webview.AwContents.VisualStateCallback;
import org.chromium.base.ThreadUtils;
import org.chromium.content_public.browser.WebContents;
import org.chromium.content_public.browser.WebContentsObserver;
-import org.chromium.net.NetError;
import java.lang.ref.WeakReference;
@@ -51,29 +50,13 @@ 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) {
+ if (isMainFrame && !isErrorUrl) {
// Need to call onPageFinished after onReceivedError (if there is an error) for
// backwards compatibility with the classic webview.
+ //
+ // onReceivedError is called from AwContents.IoThreadClientImpl.onReceivedError
+ // It is not possible to move this code there, because onReceivedError is not called
+ // when WebView receives 204 (No content) reply from the server.
sgurun-gerrit only 2015/03/17 00:30:04 huh, this sentence made me confused because of use
mnaganov (inactive) 2015/03/17 15:29:09 I rethought this and change an approach a bit. To
mAwContentsClient.onPageFinished(failingUrl);
}
}

Powered by Google App Engine
This is Rietveld 408576698