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

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

Issue 1491263002: Revert of Fixes document type detection on iOS 9. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | ios/web/web_state/ui/crw_web_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | ios/web/web_state/ui/crw_web_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698