| 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 7c0a4780f1236708eae2e77a6d36b37cc9c1c83b..072b026e1a0f55cc8d8b9363d33d550cd6d0a18f 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,7 +4,6 @@
|
|
|
| #import "ios/web/web_state/ui/crw_ui_web_view_web_controller.h"
|
|
|
| -#import "base/ios/ios_util.h"
|
| #import "base/ios/ns_error_util.h"
|
| #import "base/ios/weak_nsobject.h"
|
| #include "base/json/json_reader.h"
|
| @@ -551,25 +550,13 @@
|
| if (!_uiWebView) {
|
| return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC;
|
| }
|
| -
|
| - if (base::ios::IsRunningOnIOS9OrLater()) {
|
| - // On iOS 9, evaluating '' + document always results in [object
|
| - // HTMLDocument], even for PDFs. However, document.contentType is properly
|
| - // defined.
|
| - NSString* MIMEType = [_uiWebView
|
| - stringByEvaluatingJavaScriptFromString:@"document.contentType"];
|
| - return [self documentTypeFromMIMEType:MIMEType];
|
| - } else {
|
| - // On iOS 8 and below, document.contentType is always undefined. Use this
|
| - // instead.
|
| - NSString* documentType =
|
| - [_uiWebView stringByEvaluatingJavaScriptFromString:@"'' + document"];
|
| - if ([documentType isEqualToString:@"[object HTMLDocument]"])
|
| - return web::WEB_VIEW_DOCUMENT_TYPE_HTML;
|
| - else if ([documentType isEqualToString:@"[object Document]"])
|
| - return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC;
|
| - }
|
| -
|
| + NSString* documentType =
|
| + [_uiWebView stringByEvaluatingJavaScriptFromString:
|
| + @"'' + document"];
|
| + if ([documentType isEqualToString:@"[object HTMLDocument]"])
|
| + return web::WEB_VIEW_DOCUMENT_TYPE_HTML;
|
| + else if ([documentType isEqualToString:@"[object Document]"])
|
| + return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC;
|
| return web::WEB_VIEW_DOCUMENT_TYPE_UNKNOWN;
|
| }
|
|
|
|
|