From 2430aa5583a4403024fff7918bcf8ef2a3fb9e1a Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 31 Mar 2011 13:08:10 +0000 Subject: [PATCH] Add support for addMessageToConsole:. --- LockScreen.mm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/LockScreen.mm b/LockScreen.mm index 0c345a1..455a2c6 100644 --- a/LockScreen.mm +++ b/LockScreen.mm @@ -200,6 +200,7 @@ static float CYScrollViewDecelerationRateNormal; - (void) setDataDetectorTypes:(int)types; - (UIScrollView *) _scrollView; - (UIScroller *) _scroller; +- (void) webView:(WebView *)view addMessageToConsole:(NSDictionary *)message; - (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame; @end @@ -234,6 +235,10 @@ static float CYScrollViewDecelerationRateNormal; [super webView:view didClearWindowObject:window forFrame:frame]; } +- (void) webView:(WebView *)view addMessageToConsole:(NSDictionary *)message { + NSLog(@"addMessageToConsole:%@", message); +} + @end @interface WebCydgetLockScreenView : UIView { @@ -834,6 +839,12 @@ static void msset_(Type_ &function, const char *name, MSImageRef handle) { @implementation WebCycriptLockScreenController +static void $UIWebViewWebViewDelegate$webView$addMessageToConsole$(UIWebViewWebViewDelegate *self, SEL sel, WebView *view, NSDictionary *message) { + UIWebView *uiWebView(MSHookIvar(self, "uiWebView")); + if ([uiWebView respondsToSelector:@selector(webView:addMessageToConsole:)]) + [uiWebView webView:view addMessageToConsole:message]; +} + static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIWebViewWebViewDelegate *self, SEL sel, WebView *view, WebScriptObject *window, WebFrame *frame) { UIWebView *uiWebView(MSHookIvar(self, "uiWebView")); if ([uiWebView respondsToSelector:@selector(webView:didClearWindowObject:forFrame:)]) @@ -841,8 +852,10 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW } + (void) initialize { - if (Class $UIWebViewWebViewDelegate = objc_getClass("UIWebViewWebViewDelegate")) + if (Class $UIWebViewWebViewDelegate = objc_getClass("UIWebViewWebViewDelegate")) { + class_addMethod($UIWebViewWebViewDelegate, @selector(webView:addMessageToConsole:), (IMP) &$UIWebViewWebViewDelegate$webView$addMessageToConsole$, "v16@0:4@8@12"); class_addMethod($UIWebViewWebViewDelegate, @selector(webView:didClearWindowObject:forFrame:), (IMP) &$UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$, "v20@0:4@8@12@16"); + } if (float *_UIScrollViewDecelerationRateNormal = reinterpret_cast(dlsym(RTLD_DEFAULT, "UIScrollViewDecelerationRateNormal"))) CYScrollViewDecelerationRateNormal = *_UIScrollViewDecelerationRateNormal; -- 2.45.2