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 1cb9902c351c7f624e7a41fc9394c34c108d5aab..8d84161aeef11bf90a57ecd3abbef4ceb69c5f4b 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/ns_error_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_internal_creation_util.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::ios::GetFinalUnderlyingErrorFromError(cancelledError); |
+ NSString* netDomain = base::SysUTF8ToNSString(net::kErrorDomain); |
+ return [underlyingError.domain isEqualToString:netDomain]; |
} |
#pragma mark - JS to ObjC messaging |