1 /* CydgetScript - open-source IntelliDial replacement
2 * Copyright (C) 2009 Jay Freeman (saurik)
6 * Redistribution and use in source and binary
7 * forms, with or without modification, are permitted
8 * provided that the following conditions are met:
10 * 1. Redistributions of source code must retain the
11 * above copyright notice, this list of conditions
12 * and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the
14 * above copyright notice, this list of conditions
15 * and the following disclaimer in the documentation
16 * and/or other materials provided with the
18 * 3. The name of the author may not be used to endorse
19 * or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS''
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
24 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
33 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
35 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 #include <substrate.h>
40 #import <GraphicsServices/GraphicsServices.h>
41 #import <UIKit/UIKit.h>
42 #import <AddressBook/AddressBook.h>
44 #import <SpringBoardUI/SBAwayViewPluginController.h>
45 #import <TelephonyUI/TPBottomLockBar.h>
47 #import <QuartzCore/CALayer.h>
48 // XXX: fix the minimum requirement
49 extern NSString * const kCAFilterNearest;
51 #include <WebKit/DOMCSSPrimitiveValue.h>
52 #include <WebKit/DOMCSSStyleDeclaration.h>
53 #include <WebKit/DOMDocument.h>
54 #include <WebKit/DOMHTMLBodyElement.h>
55 #include <WebKit/DOMNodeList.h>
56 #include <WebKit/DOMRGBColor.h>
58 #include <WebKit/WebFrame.h>
59 #include <WebKit/WebPolicyDelegate.h>
60 #include <WebKit/WebPreferences.h>
61 #include <WebKit/WebScriptObject.h>
63 #import <WebKit/WebView.h>
64 #import <WebKit/WebView-WebPrivate.h>
66 #include <WebCore/Page.h>
67 #include <WebCore/Settings.h>
69 #include <WebCore/WebCoreThread.h>
70 #include <WebKit/WebPreferences-WebPrivate.h>
73 #include "JSGlobalData.h"
75 @interface WebView (UICaboodle)
76 - (void) setScriptDebugDelegate:(id)delegate;
77 - (void) _setFormDelegate:(id)delegate;
78 - (void) _setUIKitDelegate:(id)delegate;
79 - (void) setWebMailDelegate:(id)delegate;
80 - (void) _setLayoutInterval:(float)interval;
84 #define _forever for (;;)
86 _disused static unsigned trace_;
88 #define _trace() do { \
89 NSLog(@"_trace(%u)@%s:%u[%s]\n", \
90 trace_++, __FILE__, __LINE__, __FUNCTION__\
94 @protocol CydgetController
95 - (NSDictionary *) currentConfiguration;
98 static void (*CYSetupContext)(JSGlobalContextRef);
100 static Class $CydgetController(objc_getClass("CydgetController"));
102 @interface NSString (UIKit)
103 - (NSString *) stringByAddingPercentEscapes;
106 @implementation UIWebDocumentView (WebCycript)
108 - (void) _setScrollerOffset:(CGPoint)offset {
109 UIScroller *scroller([self _scroller]);
111 CGSize size([scroller contentSize]);
112 CGSize bounds([scroller bounds].size);
115 max.x = size.width - bounds.width;
116 max.y = size.height - bounds.height;
124 offset.x = offset.x < 0 ? 0 : offset.x > max.x ? max.x : offset.x;
125 offset.y = offset.y < 0 ? 0 : offset.y > max.y ? max.y : offset.y;
127 [scroller setOffset:offset];
132 /* WebCycript Delegate {{{ */
133 @interface WebCycriptDelegate : NSObject {
134 _transient volatile id delegate_;
137 - (void) setDelegate:(id)delegate;
138 - (id) initWithDelegate:(id)delegate;
141 @implementation WebCycriptDelegate
143 - (void) setDelegate:(id)delegate {
144 delegate_ = delegate;
147 - (id) initWithDelegate:(id)delegate {
148 delegate_ = delegate;
152 - (void) webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame {
153 if (delegate_ != nil)
154 return [delegate_ webView:sender didClearWindowObject:window forFrame:frame];
157 - (void) webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame {
158 if (delegate_ != nil)
159 return [delegate_ webView:sender didCommitLoadForFrame:frame];
162 - (void) webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame {
163 if (delegate_ != nil)
164 return [delegate_ webView:sender didFailLoadWithError:error forFrame:frame];
167 - (void) webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame {
168 if (delegate_ != nil)
169 return [delegate_ webView:sender didFailProvisionalLoadWithError:error forFrame:frame];
172 - (void) webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
173 if (delegate_ != nil)
174 return [delegate_ webView:sender didFinishLoadForFrame:frame];
177 /*- (void) webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame {
178 if (delegate_ != nil)
179 return [delegate_ webView:sender didReceiveTitle:title forFrame:frame];
182 - (void) webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame {
183 if (delegate_ != nil)
184 return [delegate_ webView:sender didStartProvisionalLoadForFrame:frame];
187 /*- (void) webView:(WebView *)sender resource:(id)identifier didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)source {
188 if (delegate_ != nil)
189 return [delegate_ webView:sender resource:identifier didReceiveAuthenticationChallenge:challenge fromDataSource:source];
192 /*- (NSURLRequest *) webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)source {
193 if (delegate_ != nil)
194 return [delegate_ webView:sender resource:identifier willSendRequest:request redirectResponse:redirectResponse fromDataSource:source];
198 - (IMP) methodForSelector:(SEL)sel {
199 if (IMP method = [super methodForSelector:sel])
201 fprintf(stderr, "methodForSelector:[%s] == NULL\n", sel_getName(sel));
205 - (BOOL) respondsToSelector:(SEL)sel {
206 if ([super respondsToSelector:sel])
208 // XXX: WebThreadCreateNSInvocation returns nil
209 //fprintf(stderr, "[%s]R?%s\n", class_getName(self->isa), sel_getName(sel));
210 return delegate_ == nil ? NO : [delegate_ respondsToSelector:sel];
213 - (NSMethodSignature *) methodSignatureForSelector:(SEL)sel {
214 if (NSMethodSignature *method = [super methodSignatureForSelector:sel])
216 //fprintf(stderr, "[%s]S?%s\n", class_getName(self->isa), sel_getName(sel));
217 if (delegate_ != nil)
218 if (NSMethodSignature *sig = [delegate_ methodSignatureForSelector:sel])
220 // XXX: I fucking hate Apple so very very bad
221 return [NSMethodSignature signatureWithObjCTypes:"v@:"];
224 - (void) forwardInvocation:(NSInvocation *)inv {
225 SEL sel = [inv selector];
226 if (delegate_ != nil && [delegate_ respondsToSelector:sel])
227 [inv invokeWithTarget:delegate_];
233 @interface WebCydgetLockScreenView : UIView {
234 WebCycriptDelegate *indirect_;
235 UIProgressIndicator *indicator_;
236 UIScroller *scroller_;
237 UIWebDocumentView *document_;
246 NSMutableSet *loading_;
253 @implementation WebCydgetLockScreenView
255 //#include "UICaboodle/UCInternal.h"
260 WebView *webview([document_ webView]);
261 [webview setFrameLoadDelegate:nil];
262 [webview setResourceLoadDelegate:nil];
263 [webview setUIDelegate:nil];
264 [webview setScriptDebugDelegate:nil];
265 [webview setPolicyDelegate:nil];
267 /* XXX: these are set by UIWebDocumentView
268 [webview setDownloadDelegate:nil];
269 [webview _setFormDelegate:nil];
270 [webview _setUIKitDelegate:nil];
271 [webview setEditingDelegate:nil];*/
273 /* XXX: no one sets this, ever
274 [webview setWebMailDelegate:nil];*/
276 [document_ setDelegate:nil];
277 [document_ setGestureDelegate:nil];
278 [document_ setFormEditingDelegate:nil];
279 [document_ setInteractionDelegate:nil];
281 [indirect_ setDelegate:nil];
290 [scroller_ setDelegate:nil];
296 [indicator_ release];
300 + (float) defaultWidth {
304 - (void) _setTileDrawingEnabled:(BOOL)enabled {
305 //[document_ setTileDrawingEnabled:enabled];
308 - (void) willStartGesturesInView:(UIView *)view forEvent:(GSEventRef)event {
309 [self _setTileDrawingEnabled:NO];
312 - (void) didFinishGesturesInView:(UIView *)view forEvent:(GSEventRef)event {
313 [self _setTileDrawingEnabled:YES];
314 [document_ redrawScaledDocument];
317 - (void) setViewportWidth:(float)width {
318 width_ = width != 0 ? width : [[self class] defaultWidth];
319 [document_ setViewportSize:CGSizeMake(width_, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10];
322 - (void) scrollerWillStartDragging:(UIScroller *)scroller {
323 [self _setTileDrawingEnabled:NO];
326 - (void) scrollerDidEndDragging:(UIScroller *)scroller willSmoothScroll:(BOOL)smooth {
327 [self _setTileDrawingEnabled:YES];
330 - (void) scrollerDidEndDragging:(UIScroller *)scroller {
331 [self _setTileDrawingEnabled:YES];
334 - (void) loadRequest:(NSURLRequest *)request {
338 [document_ loadRequest:request];
342 - (void) loadURL:(NSURL *)url cachePolicy:(NSURLRequestCachePolicy)policy {
343 [self loadRequest:[NSURLRequest
350 - (void) loadURL:(NSURL *)url {
351 [self loadURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy];
355 CGRect frame = {{0, 0}, {320, 480}};
356 frame.size.height -= GSDefaultStatusBarHeight();
358 if ((self = [super initWithFrame:frame]) != nil) {
359 struct CGRect bounds([self bounds]);
361 scroller_ = [[UIScroller alloc] initWithFrame:bounds];
362 [self addSubview:scroller_];
364 [scroller_ setFixedBackgroundPattern:YES];
365 [scroller_ setBackgroundColor:[UIColor blackColor]];
367 [scroller_ setScrollingEnabled:YES];
368 [scroller_ setClipsSubviews:YES];
369 [scroller_ setAllowsRubberBanding:YES];
371 [scroller_ setDelegate:self];
372 [scroller_ setBounces:YES];
373 [scroller_ setScrollHysteresis:8];
374 [scroller_ setThumbDetectionEnabled:NO];
375 [scroller_ setDirectionalScrolling:YES];
376 [scroller_ setScrollDecelerationFactor:0.99]; /* 0.989324 */
377 [scroller_ setEventMode:YES];
378 [scroller_ setShowBackgroundShadow:NO]; /* YES */
379 [scroller_ setAllowsRubberBanding:YES]; /* Vertical */
380 [scroller_ setAdjustForContentSizeChange:YES]; /* NO */
382 CGRect rect([scroller_ bounds]);
383 //rect.size.height = 0;
387 document_ = [[UIWebDocumentView alloc] initWithFrame:rect];
388 WebView *webview([document_ webView]);
390 [document_ setBackgroundColor:[UIColor blackColor]];
391 if ([document_ respondsToSelector:@selector(setDrawsBackground:)])
392 [document_ setDrawsBackground:NO];
393 [webview setDrawsBackground:NO];
395 [webview setPreferencesIdentifier:@"WebCycript"];
397 [document_ setTileSize:CGSizeMake(rect.size.width, 500)];
399 if ([document_ respondsToSelector:@selector(enableReachability)])
400 [document_ enableReachability];
402 [document_ setAllowsMessaging:YES];
404 if ([document_ respondsToSelector:@selector(useSelectionAssistantWithMode:)])
405 [document_ useSelectionAssistantWithMode:0];
407 [document_ setTilingEnabled:YES];
408 [document_ setDrawsGrid:NO];
409 [document_ setLogsTilingChanges:NO];
410 [document_ setTileMinificationFilter:kCAFilterNearest];
412 if ([document_ respondsToSelector:@selector(setDataDetectorTypes:)])
413 /* XXX: abstractify */
414 [document_ setDataDetectorTypes:0x80000000];
416 [document_ setDetectsPhoneNumbers:NO];
418 [document_ setAutoresizes:YES];
420 [document_ setMinimumScale:0.25f forDocumentTypes:0x10];
421 [document_ setMaximumScale:5.00f forDocumentTypes:0x10];
422 [document_ setInitialScale:UIWebViewScalesToFitScale forDocumentTypes:0x10];
423 //[document_ setViewportSize:CGSizeMake(980, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10];
425 [document_ setViewportSize:CGSizeMake(320, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x2];
427 [document_ setMinimumScale:1.00f forDocumentTypes:0x8];
428 [document_ setInitialScale:UIWebViewScalesToFitScale forDocumentTypes:0x8];
429 [document_ setViewportSize:CGSizeMake(320, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x8];
431 [document_ _setDocumentType:0x4];
433 if ([document_ respondsToSelector:@selector(setZoomsFocusedFormControl:)])
434 [document_ setZoomsFocusedFormControl:YES];
435 [document_ setContentsPosition:7];
436 [document_ setEnabledGestures:0xa];
437 [document_ setValue:[NSNumber numberWithBool:YES] forGestureAttribute:UIGestureAttributeIsZoomRubberBandEnabled];
438 [document_ setValue:[NSNumber numberWithBool:YES] forGestureAttribute:UIGestureAttributeUpdatesScroller];
440 [document_ setSmoothsFonts:YES];
441 [document_ setAllowsImageSheet:YES];
442 [webview _setUsesLoaderCache:YES];
444 [webview setGroupName:@"CydgetGroup"];
446 WebPreferences *preferences([webview preferences]);
448 if ([webview respondsToSelector:@selector(_setLayoutInterval:)])
449 [webview _setLayoutInterval:0];
451 [preferences _setLayoutInterval:0];
453 [self setViewportWidth:0];
455 [document_ setDelegate:self];
456 [document_ setGestureDelegate:self];
457 [document_ setFormEditingDelegate:self];
458 [document_ setInteractionDelegate:self];
460 [scroller_ addSubview:document_];
462 //NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
464 indirect_ = [[WebCycriptDelegate alloc] initWithDelegate:self];
466 [webview setFrameLoadDelegate:indirect_];
467 [webview setPolicyDelegate:indirect_];
468 [webview setResourceLoadDelegate:indirect_];
469 [webview setUIDelegate:indirect_];
471 /* XXX: do not turn this on under penalty of extreme pain */
472 [webview setScriptDebugDelegate:nil];
476 CGSize indsize([UIProgressIndicator defaultSizeForStyle:UIProgressIndicatorStyleMediumWhite]);
477 indicator_ = [[UIProgressIndicator alloc] initWithFrame:CGRectMake(281, 12, indsize.width, indsize.height)];
478 [indicator_ setStyle:UIProgressIndicatorStyleMediumWhite];
480 [self setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
481 [scroller_ setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
483 NSDictionary *configuration([$CydgetController currentConfiguration]);
484 cycript_ = [[configuration objectForKey:@"Cycript"] boolValue];
485 NSString *homepage([configuration objectForKey:@"Homepage"]);
486 [self loadURL:[NSURL URLWithString:homepage]];
490 - (void) webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
493 UIActionSheet *sheet = [[[UIActionSheet alloc]
495 buttons:[NSArray arrayWithObjects:@"OK", nil]
501 [sheet setBodyText:message];
502 [sheet popupAlertAnimated:YES];
505 - (BOOL) webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
508 UIActionSheet *sheet = [[[UIActionSheet alloc]
510 buttons:[NSArray arrayWithObjects:@"OK", @"CANCEL", nil]
516 [sheet setNumberOfRows:1];
517 [sheet setBodyText:message];
518 [sheet popupAlertAnimated:YES];
520 NSRunLoop *loop([NSRunLoop currentRunLoop]);
521 NSDate *future([NSDate distantFuture]);
523 while (confirm_ == nil && [loop runMode:NSDefaultRunLoopMode beforeDate:future]);
525 NSNumber *confirm([confirm_ autorelease]);
529 return [confirm boolValue];
532 /* XXX: WebThreadLock? */
533 - (void) _fixScroller:(CGRect)bounds {
538 UIFormAssistant *assistant([UIFormAssistant sharedFormAssistant]);
539 CGRect peripheral([assistant peripheralFrame]);
540 extra = peripheral.size.height;
543 CGRect subrect([scroller_ frame]);
544 subrect.size.height -= [TPBottomLockBar defaultHeight];
545 subrect.size.height -= extra;
546 [scroller_ setScrollerIndicatorSubrect:subrect];
549 NSSize visible(NSMakeSize(subrect.size.width, subrect.size.height));
550 [document_ setValue:[NSValue valueWithSize:visible] forGestureAttribute:UIGestureAttributeVisibleSize];
553 size.height += extra;
554 size.height += [TPBottomLockBar defaultHeight];
555 [scroller_ setContentSize:size];
557 [scroller_ releaseRubberBandIfNecessary];
560 - (void) fixScroller {
561 CGRect bounds([document_ documentBounds]);
562 [self _fixScroller:bounds];
565 - (void) view:(UIView *)sender didSetFrame:(CGRect)frame {
567 [self _fixScroller:frame];
570 - (void) view:(UIView *)sender didSetFrame:(CGRect)frame oldFrame:(CGRect)old {
571 [self view:sender didSetFrame:frame];
574 - (void) webView:(WebView *)sender willBeginEditingFormElement:(id)element {
578 - (void) webView:(WebView *)sender didBeginEditingFormElement:(id)element {
582 - (void) webViewDidEndEditingFormElements:(WebView *)sender {
587 - (void) webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame {
588 if (cycript_ && CYSetupContext != NULL) {
589 WebView *webview([document_ webView]);
590 WebFrame *frame([webview mainFrame]);
591 JSGlobalContextRef context([frame globalContext]);
592 CYSetupContext(context);
597 return [loading_ count] != 0;
600 - (void) reloadButtons {
601 if ([self isLoading])
602 [indicator_ startAnimation];
604 [indicator_ stopAnimation];
607 - (void) _finishLoading {
608 size_t count([loading_ count]);
610 [self autorelease];*/
611 if (reloading_ || count != 0)
613 [self reloadButtons];
616 - (BOOL) webView:(WebView *)sender shouldScrollToPoint:(struct CGPoint)point forFrame:(WebFrame *)frame {
617 return [document_ webView:sender shouldScrollToPoint:point forFrame:frame];
620 - (void) webView:(WebView *)sender didReceiveViewportArguments:(id)arguments forFrame:(WebFrame *)frame {
621 return [document_ webView:sender didReceiveViewportArguments:arguments forFrame:frame];
624 - (void) webView:(WebView *)sender needsScrollNotifications:(id)notifications forFrame:(WebFrame *)frame {
625 return [document_ webView:sender needsScrollNotifications:notifications forFrame:frame];
628 - (void) webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame {
629 return [document_ webView:sender didCommitLoadForFrame:frame];
632 - (void) webView:(WebView *)sender didReceiveDocTypeForFrame:(WebFrame *)frame {
633 return [document_ webView:sender didReceiveDocTypeForFrame:frame];
636 - (void) webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
637 [loading_ removeObject:[NSValue valueWithNonretainedObject:frame]];
638 [self _finishLoading];
639 return [document_ webView:sender didFinishLoadForFrame:frame];
642 - (void) webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame {
643 /*if ([loading_ count] == 0)
645 [loading_ addObject:[NSValue valueWithNonretainedObject:frame]];
647 if ([frame parentFrame] == nil) {
648 [document_ resignFirstResponder];
652 [scroller_ scrollPointVisibleAtTopLeft:CGPointZero];
654 if ([scroller_ respondsToSelector:@selector(setZoomScale:duration:)])
655 [scroller_ setZoomScale:1 duration:0];
656 else if ([scroller_ respondsToSelector:@selector(_setZoomScale:duration:)])
657 [scroller_ _setZoomScale:1 duration:0];
658 /*else if ([scroller_ respondsToSelector:@selector(setZoomScale:animated:)])
659 [scroller_ setZoomScale:1 animated:NO];*/
661 CGRect rect([scroller_ bounds]);
662 //rect.size.height = 0;
663 [document_ setFrame:rect];
666 [self reloadButtons];
669 - (void) _didFailWithError:(NSError *)error forFrame:(WebFrame *)frame {
670 /*if ([frame parentFrame] == nil)
671 [self autorelease];*/
673 [loading_ removeObject:[NSValue valueWithNonretainedObject:frame]];
674 [self _finishLoading];
679 if ([frame parentFrame] == nil) {
680 [self loadURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@?%@",
681 [[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"error" ofType:@"html"]] absoluteString],
682 [[error localizedDescription] stringByAddingPercentEscapes]
689 - (void) webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame {
690 [self _didFailWithError:error forFrame:frame];
693 - (void) webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame {
694 [self _didFailWithError:error forFrame:frame];
697 - (void) webView:(WebView *)sender addMessageToConsole:(NSDictionary *)dictionary {
698 fprintf(stderr, "Console:%s\n", [[dictionary description] UTF8String]);
703 @interface WebCycriptLockScreenController : SBAwayViewPluginController {
708 /*extern "C" void _ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE(JSC::Parser *, JSC::JSGlobalData *, int *, JSC::UString *);
709 MSHook(void, _ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE, JSC::Parser *_this, JSC::JSGlobalData *data, int *line, JSC::UString *message) {
710 return __ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE(_this, data, line, message);
713 @implementation WebCycriptLockScreenController
715 + (void) initialize {
716 //MSHookFunction(&_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE, MSHake(_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE));
717 if (void *handle = dlopen("/usr/lib/libcycript.dylib", RTLD_LAZY | RTLD_GLOBAL))
718 CYSetupContext = reinterpret_cast<void (*)(JSGlobalContextRef)>(dlsym(handle, "CYSetupContext"));
721 + (id) rootViewController {
722 return [[[self alloc] init] autorelease];
726 [self setView:[[[WebCydgetLockScreenView alloc] init] autorelease]];