summaryrefslogtreecommitdiffstats
path: root/ios/web
diff options
context:
space:
mode:
authorshreyasv <shreyasv@chromium.org>2016-03-07 15:00:23 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-07 23:02:44 +0000
commit1f3be7127805deb97fb3d8bebd32a4b5da8a5f53 (patch)
tree5f3e9f73ad5833c1f859c18cb592544afff4e807 /ios/web
parentfa995b915f2d45653eb267c693498b2cca1c9127 (diff)
downloadchromium_src-1f3be7127805deb97fb3d8bebd32a4b5da8a5f53.zip
chromium_src-1f3be7127805deb97fb3d8bebd32a4b5da8a5f53.tar.gz
chromium_src-1f3be7127805deb97fb3d8bebd32a4b5da8a5f53.tar.bz2
Removing CRWDebugWebView
BUG=579697 Review URL: https://codereview.chromium.org/1767863002 Cr-Commit-Position: refs/heads/master@{#379675}
Diffstat (limited to 'ios/web')
-rw-r--r--ios/web/BUILD.gn2
-rw-r--r--ios/web/ios_web.gyp2
-rw-r--r--ios/web/web_state/ui/crw_debug_web_view.h61
-rw-r--r--ios/web/web_state/ui/crw_debug_web_view.mm113
-rw-r--r--ios/web/web_state/web_view_internal_creation_util.mm15
-rw-r--r--ios/web/web_state/web_view_internal_creation_util_unittest.mm16
6 files changed, 1 insertions, 208 deletions
diff --git a/ios/web/BUILD.gn b/ios/web/BUILD.gn
index cf8b14c..bf1b54b 100644
--- a/ios/web/BUILD.gn
+++ b/ios/web/BUILD.gn
@@ -217,8 +217,6 @@ source_set("web") {
"web_state/page_viewport_state.mm",
"web_state/ui/crw_context_menu_provider.h",
"web_state/ui/crw_context_menu_provider.mm",
- "web_state/ui/crw_debug_web_view.h",
- "web_state/ui/crw_debug_web_view.mm",
"web_state/ui/crw_generic_content_view.mm",
"web_state/ui/crw_simple_web_view_controller.h",
"web_state/ui/crw_static_file_web_view.h",
diff --git a/ios/web/ios_web.gyp b/ios/web/ios_web.gyp
index 97c4e9c..008c807 100644
--- a/ios/web/ios_web.gyp
+++ b/ios/web/ios_web.gyp
@@ -253,8 +253,6 @@
'web_state/page_viewport_state.mm',
'web_state/ui/crw_context_menu_provider.h',
'web_state/ui/crw_context_menu_provider.mm',
- 'web_state/ui/crw_debug_web_view.h',
- 'web_state/ui/crw_debug_web_view.mm',
'web_state/ui/crw_generic_content_view.mm',
'web_state/ui/crw_simple_web_view_controller.h',
'web_state/ui/crw_static_file_web_view.h',
diff --git a/ios/web/web_state/ui/crw_debug_web_view.h b/ios/web/web_state/ui/crw_debug_web_view.h
deleted file mode 100644
index 872d18f..0000000
--- a/ios/web/web_state/ui/crw_debug_web_view.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-#ifndef IOS_WEB_WEB_STATE_UI_CRW_DEBUG_WEB_VIEW_H_
-#define IOS_WEB_WEB_STATE_UI_CRW_DEBUG_WEB_VIEW_H_
-
-// This class is only available in debug mode. It uses private API.
-#if !defined(NDEBUG)
-
-#import <UIKit/UIKit.h>
-
-// All part of webkit API, but it is private on iOS.
-@class WebFrame;
-@class WebScriptCallFrame;
-@class WebView;
-
-@protocol CRWDebugWebView_WebViewScriptDelegate
-@optional
-// Called when a javascript statement want to write on the console.
-- (void)webView:(WebView*)webView addMessageToConsole:(NSDictionary*)dict;
-
-// Some source was parsed, establishing a "source ID" (>= 0) for future
-// reference
-- (void)webView:(WebView*)webView
- didParseSource:(NSString*)source
- baseLineNumber:(NSUInteger)lineNumber
- fromURL:(NSURL*)url
- sourceId:(int)sid
- forWebFrame:(WebFrame*)webFrame;
-
-// Called if a loaded javascript file fail to parse.
-- (void)webView:(WebView*)webView
- failedToParseSource:(NSString*)source
- baseLineNumber:(unsigned)lineNumber
- fromURL:(NSURL*)url
- withError:(NSError*)error
- forWebFrame:(WebFrame*)webFrame;
-
-// Called if an exception is raised in Javascript.
-- (void)webView:(WebView*)webView
- exceptionWasRaised:(WebScriptCallFrame*)frame
- sourceId:(int)sid
- line:(int)lineno
- forWebFrame:(WebFrame*)webFrame;
-
-@end
-
-// Simply use like a regular UIWebView. It just logs javascript information on
-// the console.
-@interface CRWDebugWebView : UIWebView
-
-// Webview delegate API, which the superclass is. Used to set the script
-// delegate on the same webview the superclass is delegate of.
-- (void)webView:(id)sender
- didClearWindowObject:(id)windowObject
- forFrame:(WebFrame*)frame;
-
-@end
-
-#endif // !defined(NDEBUG)
-#endif // IOS_WEB_WEB_STATE_UI_CRW_DEBUG_WEB_VIEW_H_
diff --git a/ios/web/web_state/ui/crw_debug_web_view.mm b/ios/web/web_state/ui/crw_debug_web_view.mm
deleted file mode 100644
index 4fdb439..0000000
--- a/ios/web/web_state/ui/crw_debug_web_view.mm
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-#if !defined(NDEBUG)
-#import "ios/web/web_state/ui/crw_debug_web_view.h"
-
-#include "base/mac/scoped_nsobject.h"
-
-// These categories define private API in iOS, in reality part of WebKit.
-@interface NSObject (CRWDebugWebView_WebScriptCallFrame_methods)
-- (id)functionName;
-- (id)caller;
-- (id)exception;
-@end
-
-@interface NSObject (CRWDebugWebView_WebView_methods)
-- (void)setScriptDebugDelegate:
- (id<CRWDebugWebView_WebViewScriptDelegate>)delegate;
-@end
-
-@interface NSObject (CRWDebugWebView_WebScriptObject_methods)
-- (id)callWebScriptMethod:(NSString*)name withArguments:(NSArray*)args;
-@end
-
-#pragma mark -
-
-// The debug implementation of the webscript delegate.
-@interface CRWDebugWebDelegate :
-NSObject<CRWDebugWebView_WebViewScriptDelegate> {
- base::scoped_nsobject<NSMutableDictionary> _sidsToURLs;
-}
-@end
-
-@implementation CRWDebugWebDelegate
-
-- (id)init {
- if ((self = [super init])) {
- _sidsToURLs.reset([[NSMutableDictionary alloc] init]);
- }
- return self;
-}
-
-- (void)webView:(WebView*)webView addMessageToConsole:(NSDictionary*)dict {
- NSLog(@"JS: %@", dict);
-}
-
-- (void)webView:(WebView*)webView
- didParseSource:(NSString*)source
- baseLineNumber:(NSUInteger)lineNumber
- fromURL:(NSURL*)url
- sourceId:(int)sid
- forWebFrame:(WebFrame*)webFrame {
- if (url && sid)
- [_sidsToURLs setObject:url forKey:[NSNumber numberWithInt:sid]];
-}
-
-- (void)webView:(WebView*)webView
- failedToParseSource:(NSString*)source
- baseLineNumber:(unsigned)lineNumber
- fromURL:(NSURL*)url
- withError:(NSError*)error
- forWebFrame:(WebFrame*)webFrame {
- NSLog(@"JS Failed to parse: url=%@ line=%d error=%@\nsource=%@",
- url, lineNumber, error, source);
-}
-
-- (void)webView:(WebView*)webView
- exceptionWasRaised:(WebScriptCallFrame*)frame
- sourceId:(int)sid
- line:(int)lineno
- forWebFrame:(WebFrame*)webFrame {
- NSURL* url = [_sidsToURLs objectForKey:[NSNumber numberWithInt:sid]];
- id representation = [frame exception];
- if ([representation isKindOfClass:NSClassFromString(@"WebScriptObject")]) {
- representation =
- [representation callWebScriptMethod:@"toString" withArguments:nil];
- }
- base::scoped_nsobject<NSMutableArray> message([[NSMutableArray alloc] init]);
-
- [message addObject:
- [NSString stringWithFormat:@"JS Exception: sid=%d url=%@ exception=%@",
- sid, url, representation]];
-
- if ([frame respondsToSelector:@selector(caller)]) {
- while (frame) {
- frame = [frame caller];
- [message addObject:[NSString stringWithFormat:@"line=%d function=%@",
- lineno, [frame functionName]]];
- }
- }
-
- NSLog(@"%@", [message componentsJoinedByString:@"\n\t"]);
-}
-
-@end
-
-#pragma mark -
-
-@implementation CRWDebugWebView {
- base::scoped_nsobject<CRWDebugWebDelegate> _webDelegate;
-}
-
-- (void)webView:(id)sender
- didClearWindowObject:(id)windowObject
- forFrame:(WebFrame*)frame {
- if (!_webDelegate)
- _webDelegate.reset([[CRWDebugWebDelegate alloc] init]);
- [sender setScriptDebugDelegate:_webDelegate];
-}
-
-@end
-
-#endif // !defined(NDEBUG)
diff --git a/ios/web/web_state/web_view_internal_creation_util.mm b/ios/web/web_state/web_view_internal_creation_util.mm
index cbf01d6..cde2176 100644
--- a/ios/web/web_state/web_view_internal_creation_util.mm
+++ b/ios/web/web_state/web_view_internal_creation_util.mm
@@ -26,10 +26,6 @@
#import "ios/web/web_view_counter_impl.h"
#if !defined(NDEBUG)
-#import "ios/web/web_state/ui/crw_debug_web_view.h"
-#endif
-
-#if !defined(NDEBUG)
namespace {
// Returns the counter of all the active WKWebViews.
@@ -137,16 +133,7 @@ UIWebView* CreateWebView(CGRect frame) {
DCHECK(web::GetWebClient());
web::GetWebClient()->PreWebViewCreation();
- UIWebView* result = nil;
-#if defined(NDEBUG)
- result = [[UIWebView alloc] initWithFrame:frame];
-#else
- // TODO(eugenebut): create constant for @"LogJavascript" (crbug.com/391807).
- if ([[NSUserDefaults standardUserDefaults] boolForKey:@"LogJavascript"])
- result = [[CRWDebugWebView alloc] initWithFrame:frame];
- else
- result = [[UIWebView alloc] initWithFrame:frame];
-#endif // defined(NDEBUG)
+ UIWebView* result = [[UIWebView alloc] initWithFrame:frame];
// Disable data detector types. Safari does the same.
[result setDataDetectorTypes:UIDataDetectorTypeNone];
diff --git a/ios/web/web_state/web_view_internal_creation_util_unittest.mm b/ios/web/web_state/web_view_internal_creation_util_unittest.mm
index b00d01c..cd18bfc 100644
--- a/ios/web/web_state/web_view_internal_creation_util_unittest.mm
+++ b/ios/web/web_state/web_view_internal_creation_util_unittest.mm
@@ -17,7 +17,6 @@
#include "ios/web/public/test/web_test_util.h"
#import "ios/web/public/web_view_creation_util.h"
#import "ios/web/test/web_test.h"
-#import "ios/web/web_state/ui/crw_debug_web_view.h"
#import "ios/web/web_state/ui/crw_simple_web_view_controller.h"
#import "ios/web/web_state/ui/crw_static_file_web_view.h"
#import "ios/web/web_state/ui/wk_web_view_configuration_provider.h"
@@ -171,21 +170,6 @@ TEST_F(WebViewCreationUtilsTest, WKWebViewsShareProcessPool) {
#if !defined(NDEBUG)
-// Tests web::CreateWebView function that it correctly returns a CRWDebugWebView
-// with the correct frame and calls WebClient::PreWebViewCreation/
-// WebClient::PostWebViewCreation methods.
-TEST_F(WebViewCreationUtilsTest, DebugCreation) {
- [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"LogJavascript"];
-
- UIWebView* captured_web_view = nil;
- ExpectWebClientCalls(&captured_web_view);
-
- base::scoped_nsobject<UIWebView> web_view(CreateWebView(kTestFrame));
- EXPECT_TRUE([web_view isMemberOfClass:[CRWDebugWebView class]]);
- EXPECT_TRUE(CGRectEqualToRect(kTestFrame, [web_view frame]));
- EXPECT_NSEQ(web_view, captured_web_view);
-}
-
// Tests that getting a WKWebView from the util methods correctly maintains
// the global active wkwebview count (which is debug-only).
TEST_F(WebViewCreationUtilsTest, GetActiveWKWebViewsCount) {