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

Unified Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 1178063007: Updated error translation logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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: ios/web/web_state/ui/crw_web_controller.mm
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index e8bab8fb211d0ca839a28ad2b77eb79c8a1fd11b..bde610be155997cd62bd66aa329388446b58783a 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -51,6 +51,7 @@
#include "ios/web/public/web_state/credential.h"
#import "ios/web/public/web_state/crw_web_controller_observer.h"
#import "ios/web/public/web_state/crw_web_view_scroll_view_proxy.h"
+#import "ios/web/public/web_state/error_translation_util.h"
#import "ios/web/public/web_state/js/crw_js_injection_manager.h"
#import "ios/web/public/web_state/js/crw_js_injection_receiver.h"
#import "ios/web/public/web_state/ui/crw_native_content.h"
@@ -59,7 +60,6 @@
#include "ios/web/public/web_state/web_state.h"
#include "ios/web/web_state/blocked_popup_info.h"
#import "ios/web/web_state/crw_web_view_proxy_impl.h"
-#import "ios/web/web_state/error_translation_util.h"
#include "ios/web/web_state/frame_info.h"
#import "ios/web/web_state/js/credential_util.h"
#import "ios/web/web_state/js/crw_js_early_script_manager.h"
@@ -1423,6 +1423,7 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
const GURL currentUrl = [self currentNavigationURL];
BOOL isPost = [self currentPOSTData] != nil;
+ error = web::NetErrorFromError(error);
[self setNativeController:[_nativeProvider controllerForURL:currentUrl
withError:error
isPost:isPost]];
@@ -2820,9 +2821,6 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
}
- (void)handleLoadError:(NSError*)error inMainFrame:(BOOL)inMainFrame {
- // Attempt to translate iOS errors into their corresponding net errors.
- error = web::NetErrorFromError(error);
-
if ([error code] == NSURLErrorUnsupportedURL)
return;
// In cases where a Plug-in handles the load do not take any further action.
@@ -2884,7 +2882,7 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
}
}
- // Otherwise, handle the error normally.
+ // Ignore errors that originate from URLs that are opened in external apps.
if ([_openedApplicationURL containsObject:errorURL])
return;
// Certain frame errors don't have URL information for some reason; for
@@ -2909,17 +2907,13 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
return;
}
- // TODO(ios): Audit comments and behavior below regarding error origin. The
- // error has been translated and may appear to have originated in the Chrome
- // network stack when that is not true (crbug.com/496972)
- // Ignore cancelled errors.
if ([error code] == NSURLErrorCancelled) {
NSError* underlyingError = [userInfo objectForKey:NSUnderlyingErrorKey];
if (underlyingError && [self shouldAbortLoadForCancelledURL:errorGURL]) {
DCHECK([underlyingError isKindOfClass:[NSError class]]);
- // The Error contains an NSUnderlyingErrorKey so it's being generated
- // in the Chrome network stack. Aborting the load in this case.
+ // NSURLCancelled errors with underlying errors are generated from the
+ // chrome network stack. Aborting the load in this case.
[self abortLoad];
switch ([underlyingError code]) {
@@ -2940,6 +2934,9 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
NOTREACHED();
}
}
+ // NSURLCancelled errors with no underlying error are generated by the web
+ // view. Early return in this case, as the web view interally handles
+ // reattempting this load.
Eugene But (OOO till 7-30) 2015/06/19 00:52:01 Please make sure that LoadState will still be PAGE
kkhorimoto 2015/06/23 20:33:58 Done, although the fix is somewhat speculative. T
return;
}

Powered by Google App Engine
This is Rietveld 408576698