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

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

Issue 1178063007: Updated error translation logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Eugene's comments 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_ui_web_view_web_controller.mm
diff --git a/ios/web/web_state/ui/crw_ui_web_view_web_controller.mm b/ios/web/web_state/ui/crw_ui_web_view_web_controller.mm
index 465a7761a26958becf1e8eec431c79365adddbfb..f56724f1139ec7a744c43687770af25e2eb49f11 100644
--- a/ios/web/web_state/ui/crw_ui_web_view_web_controller.mm
+++ b/ios/web/web_state/ui/crw_ui_web_view_web_controller.mm
@@ -4,6 +4,7 @@
#import "ios/web/web_state/ui/crw_ui_web_view_web_controller.h"
+#import "base/ios/nserror_util.h"
#import "base/ios/weak_nsobject.h"
#include "base/json/json_reader.h"
#include "base/json/string_escape.h"
@@ -35,6 +36,7 @@
#import "ios/web/web_state/web_state_impl.h"
#import "ios/web/web_state/web_view_creation_utils.h"
#import "net/base/mac/url_conversions.h"
+#include "net/base/net_errors.h"
#include "url/url_constants.h"
namespace web {
@@ -804,8 +806,15 @@ const size_t kMaxMessageQueueSize = 262144;
self.webScrollView.zoomScale = zoomScale;
}
--(BOOL)shouldAbortLoadForCancelledURL:(const GURL&)cancelledURL {
- return YES;
+- (BOOL)shouldAbortLoadForCancelledError:(NSError*)cancelledError {
+ // NSURLErrorCancelled errors generated by the Chrome net stack should be
+ // aborted. If the error was generated by the UIWebView, it will not have
+ // an underlying net error and will be automatically retried by the web view.
+ DCHECK_EQ(cancelledError.code, NSURLErrorCancelled);
+ NSError* underlyingError =
+ base::nserror_util::GetFinalUnderlyingErrorFromError(cancelledError);
+ NSString* netDomain = base::SysUTF8ToNSString(net::kErrorDomain);
+ return [underlyingError.domain isEqualToString:netDomain];
}
#pragma mark - JS to ObjC messaging

Powered by Google App Engine
This is Rietveld 408576698