| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 #ifndef IOS_WEB_WEB_STATE_UI_CRW_DEBUG_WEB_VIEW_H_ |
| 5 #define IOS_WEB_WEB_STATE_UI_CRW_DEBUG_WEB_VIEW_H_ |
| 6 |
| 7 // This class is only available in debug mode. It uses private API. |
| 8 #if !defined(NDEBUG) |
| 9 |
| 10 #import <UIKit/UIKit.h> |
| 11 |
| 12 // All part of webkit API, but it is private on iOS. |
| 13 @class WebFrame; |
| 14 @class WebScriptCallFrame; |
| 15 @class WebView; |
| 16 |
| 17 @protocol CRWDebugWebView_WebViewScriptDelegate |
| 18 @optional |
| 19 // Called when a javascript statement want to write on the console. |
| 20 - (void)webView:(WebView*)webView addMessageToConsole:(NSDictionary*)dict; |
| 21 |
| 22 // Some source was parsed, establishing a "source ID" (>= 0) for future |
| 23 // reference |
| 24 - (void)webView:(WebView*)webView |
| 25 didParseSource:(NSString*)source |
| 26 baseLineNumber:(NSUInteger)lineNumber |
| 27 fromURL:(NSURL*)url |
| 28 sourceId:(int)sid |
| 29 forWebFrame:(WebFrame*)webFrame; |
| 30 |
| 31 // Called if a loaded javascript file fail to parse. |
| 32 - (void)webView:(WebView*)webView |
| 33 failedToParseSource:(NSString*)source |
| 34 baseLineNumber:(unsigned)lineNumber |
| 35 fromURL:(NSURL*)url |
| 36 withError:(NSError*)error |
| 37 forWebFrame:(WebFrame*)webFrame; |
| 38 |
| 39 // Called if an exception is raised in Javascript. |
| 40 - (void)webView:(WebView*)webView |
| 41 exceptionWasRaised:(WebScriptCallFrame*)frame |
| 42 sourceId:(int)sid |
| 43 line:(int)lineno |
| 44 forWebFrame:(WebFrame*)webFrame; |
| 45 |
| 46 @end |
| 47 |
| 48 // Simply use like a regular UIWebView. It just logs javascript information on |
| 49 // the console. |
| 50 @interface CRWDebugWebView : UIWebView |
| 51 |
| 52 // Webview delegate API, which the superclass is. Used to set the script |
| 53 // delegate on the same webview the superclass is delegate of. |
| 54 - (void)webView:(id)sender |
| 55 didClearWindowObject:(id)windowObject |
| 56 forFrame:(WebFrame*)frame; |
| 57 |
| 58 @end |
| 59 |
| 60 #endif // !defined(NDEBUG) |
| 61 #endif // IOS_WEB_WEB_STATE_UI_CRW_DEBUG_WEB_VIEW_H_ |
| OLD | NEW |