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>
39 #include <sys/sysctl.h>
41 #import <GraphicsServices/GraphicsServices.h>
42 #import <UIKit/UIKit.h>
43 #import <AddressBook/AddressBook.h>
45 #import <SpringBoard/SBStatusBarController.h>
46 #import <SpringBoardUI/SBAwayViewPluginController.h>
47 #import <TelephonyUI/TPBottomLockBar.h>
49 #import <QuartzCore/CALayer.h>
50 // XXX: fix the minimum requirement
51 extern NSString * const kCAFilterNearest;
53 #include <WebKit/DOMCSSPrimitiveValue.h>
54 #include <WebKit/DOMCSSStyleDeclaration.h>
55 #include <WebKit/DOMDocument.h>
56 #include <WebKit/DOMHTMLBodyElement.h>
57 #include <WebKit/DOMNodeList.h>
58 #include <WebKit/DOMRGBColor.h>
60 #include <WebKit/WebFrame.h>
61 #include <WebKit/WebPolicyDelegate.h>
62 #include <WebKit/WebPreferences.h>
63 #include <WebKit/WebScriptObject.h>
65 #import <WebKit/WebView.h>
66 #import <WebKit/WebView-WebPrivate.h>
68 #include <WebCore/Page.h>
69 #include <WebCore/Settings.h>
71 #include <WebCore/WebCoreThread.h>
72 #include <WebKit/WebPreferences-WebPrivate.h>
74 #include "JSGlobalData.h"
75 #include "SourceCode.h"
77 #include <apr-1/apr_pools.h>
80 @interface WebView (UICaboodle)
81 - (void) setScriptDebugDelegate:(id)delegate;
82 - (void) _setFormDelegate:(id)delegate;
83 - (void) _setUIKitDelegate:(id)delegate;
84 - (void) setWebMailDelegate:(id)delegate;
85 - (void) _setLayoutInterval:(float)interval;
89 #define _forever for (;;)
91 _disused static unsigned trace_;
93 #define _trace() do { \
94 NSLog(@"_trace(%u)@%s:%u[%s]\n", \
95 trace_++, __FILE__, __LINE__, __FUNCTION__\
99 #define _assert(test) do \
101 fprintf(stderr, "_assert(%d:%s)@%s:%u[%s]\n", errno, #test, __FILE__, __LINE__, __FUNCTION__); \
106 #define _syscall(expr) \
107 do if ((long) (expr) != -1) \
109 else switch (errno) { \
116 @protocol CydgetController
117 - (NSDictionary *) currentConfiguration;
120 static Class $CydgetController(objc_getClass("CydgetController"));
121 static Class $UIFormAssistant(objc_getClass("UIFormAssistant"));
122 static Class $SBStatusBarController(objc_getClass("SBStatusBarController"));
124 static Class $UIWebBrowserView;
125 static bool Wildcat_;
127 @interface NSString (UIKit)
128 - (NSString *) stringByAddingPercentEscapes;
131 @implementation UIWebDocumentView (WebCycript)
133 - (void) _initialize {
134 $UIWebBrowserView = objc_getClass("UIWebBrowserView");
135 if ($UIWebBrowserView == nil) {
137 $UIWebBrowserView = objc_getClass("UIWebDocumentView");
143 - (void) _setScrollerOffset:(CGPoint)offset {
144 UIScroller *scroller([self _scroller]);
146 CGSize size([scroller contentSize]);
147 CGSize bounds([scroller bounds].size);
150 max.x = size.width - bounds.width;
151 max.y = size.height - bounds.height;
159 offset.x = offset.x < 0 ? 0 : offset.x > max.x ? max.x : offset.x;
160 offset.y = offset.y < 0 ? 0 : offset.y > max.y ? max.y : offset.y;
162 [scroller setOffset:offset];
167 /* Perl-Compatible RegEx {{{ */
177 Pcre(const char *regex, int options = 0) :
182 code_ = pcre_compile(regex, options, &error, &offset, NULL);
185 @throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"*** Pcre(,): [%u] %s", offset, error] userInfo:nil];
187 pcre_fullinfo(code_, study_, PCRE_INFO_CAPTURECOUNT, &capture_);
188 matches_ = new int[(capture_ + 1) * 3];
196 NSString *operator [](size_t match) {
197 return [[[NSString alloc] initWithBytes:(data_ + matches_[match * 2]) length:(matches_[match * 2 + 1] - matches_[match * 2]) encoding:NSUTF8StringEncoding] autorelease];
200 bool operator ()(NSString *data) {
201 // XXX: length is for characters, not for bytes
202 return operator ()([data UTF8String], [data length]);
205 bool operator ()(const char *data, size_t size) {
207 return pcre_exec(code_, study_, data, size, 0, 0, matches_, (capture_ + 1) * 3) >= 0;
211 /* WebCycript Delegate {{{ */
212 @interface WebCycriptDelegate : NSObject {
213 _transient volatile id delegate_;
216 - (void) setDelegate:(id)delegate;
217 - (id) initWithDelegate:(id)delegate;
220 @implementation WebCycriptDelegate
222 - (void) setDelegate:(id)delegate {
223 delegate_ = delegate;
226 - (id) initWithDelegate:(id)delegate {
227 delegate_ = delegate;
231 - (void) webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame {
232 if (delegate_ != nil)
233 return [delegate_ webView:sender didClearWindowObject:window forFrame:frame];
236 - (void) webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame {
237 if (delegate_ != nil)
238 return [delegate_ webView:sender didCommitLoadForFrame:frame];
241 - (void) webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame {
242 if (delegate_ != nil)
243 return [delegate_ webView:sender didFailLoadWithError:error forFrame:frame];
246 - (void) webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame {
247 if (delegate_ != nil)
248 return [delegate_ webView:sender didFailProvisionalLoadWithError:error forFrame:frame];
251 - (void) webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
252 if (delegate_ != nil)
253 return [delegate_ webView:sender didFinishLoadForFrame:frame];
256 /*- (void) webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame {
257 if (delegate_ != nil)
258 return [delegate_ webView:sender didReceiveTitle:title forFrame:frame];
261 - (void) webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame {
262 if (delegate_ != nil)
263 return [delegate_ webView:sender didStartProvisionalLoadForFrame:frame];
266 /*- (void) webView:(WebView *)sender resource:(id)identifier didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)source {
267 if (delegate_ != nil)
268 return [delegate_ webView:sender resource:identifier didReceiveAuthenticationChallenge:challenge fromDataSource:source];
271 /*- (NSURLRequest *) webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)source {
272 if (delegate_ != nil)
273 return [delegate_ webView:sender resource:identifier willSendRequest:request redirectResponse:redirectResponse fromDataSource:source];
277 - (IMP) methodForSelector:(SEL)sel {
278 if (IMP method = [super methodForSelector:sel])
280 fprintf(stderr, "methodForSelector:[%s] == NULL\n", sel_getName(sel));
284 - (BOOL) respondsToSelector:(SEL)sel {
285 if ([super respondsToSelector:sel])
287 // XXX: WebThreadCreateNSInvocation returns nil
288 //fprintf(stderr, "[%s]R?%s\n", class_getName(self->isa), sel_getName(sel));
289 return delegate_ == nil ? NO : [delegate_ respondsToSelector:sel];
292 - (NSMethodSignature *) methodSignatureForSelector:(SEL)sel {
293 if (NSMethodSignature *method = [super methodSignatureForSelector:sel])
295 //fprintf(stderr, "[%s]S?%s\n", class_getName(self->isa), sel_getName(sel));
296 if (delegate_ != nil)
297 if (NSMethodSignature *sig = [delegate_ methodSignatureForSelector:sel])
299 // XXX: I fucking hate Apple so very very bad
300 return [NSMethodSignature signatureWithObjCTypes:"v@:"];
303 - (void) forwardInvocation:(NSInvocation *)inv {
304 SEL sel = [inv selector];
305 if (delegate_ != nil && [delegate_ respondsToSelector:sel])
306 [inv invokeWithTarget:delegate_];
312 @interface WebCydgetLockScreenView : UIView {
313 WebCycriptDelegate *indirect_;
314 UIProgressIndicator *indicator_;
315 UIScroller *scroller_;
316 UIWebDocumentView *document_;
327 NSMutableSet *loading_;
331 //UIKeyboard *keyboard_;
336 @implementation WebCydgetLockScreenView
338 //#include "UICaboodle/UCInternal.h"
343 WebView *webview([document_ webView]);
344 [webview setFrameLoadDelegate:nil];
345 [webview setResourceLoadDelegate:nil];
346 [webview setUIDelegate:nil];
347 [webview setScriptDebugDelegate:nil];
348 [webview setPolicyDelegate:nil];
350 /* XXX: these are set by UIWebDocumentView
351 [webview setDownloadDelegate:nil];
352 [webview _setFormDelegate:nil];
353 [webview _setUIKitDelegate:nil];
354 [webview setEditingDelegate:nil];*/
356 /* XXX: no one sets this, ever
357 [webview setWebMailDelegate:nil];*/
359 [document_ setDelegate:nil];
360 [document_ setGestureDelegate:nil];
362 if ([document_ respondsToSelector:@selector(setFormEditingDelegate:)])
363 [document_ setFormEditingDelegate:nil];
365 [document_ setInteractionDelegate:nil];
367 [indirect_ setDelegate:nil];
376 [scroller_ setDelegate:nil];
381 //[keyboard_ release];
384 [indicator_ release];
389 + (float) defaultWidth {
393 - (void) webView:(WebView *)sender didReceiveMessage:(NSDictionary *)dictionary {
394 #if LogBrowser || ForSaurik
395 lprintf("Console:%s\n", [[dictionary description] UTF8String]);
397 if ([document_ respondsToSelector:@selector(webView:didReceiveMessage:)])
398 [document_ webView:sender didReceiveMessage:dictionary];
401 - (void) webView:(id)sender willCloseFrame:(id)frame {
402 if ([document_ respondsToSelector:@selector(webView:willCloseFrame:)])
403 [document_ webView:sender willCloseFrame:frame];
406 - (void) webView:(id)sender didFinishDocumentLoadForFrame:(id)frame {
407 if ([document_ respondsToSelector:@selector(webView:didFinishDocumentLoadForFrame:)])
408 [document_ webView:sender didFinishDocumentLoadForFrame:frame];
411 - (void) webView:(id)sender didFirstLayoutInFrame:(id)frame {
412 if ([document_ respondsToSelector:@selector(webView:didFirstLayoutInFrame:)])
413 [document_ webView:sender didFirstLayoutInFrame:frame];
416 - (void) webViewFormEditedStatusHasChanged:(id)changed {
417 if ([document_ respondsToSelector:@selector(webViewFormEditedStatusHasChanged:)])
418 [document_ webViewFormEditedStatusHasChanged:changed];
421 - (void) webView:(id)sender formStateDidFocusNode:(id)formState {
422 if ([document_ respondsToSelector:@selector(webView:formStateDidFocusNode:)])
423 [document_ webView:sender formStateDidFocusNode:formState];
426 - (void) webView:(id)sender formStateDidBlurNode:(id)formState {
427 if ([document_ respondsToSelector:@selector(webView:formStateDidBlurNode:)])
428 [document_ webView:sender formStateDidBlurNode:formState];
431 - (void) webViewDidLayout:(id)sender {
432 [document_ webViewDidLayout:sender];
435 - (void) webView:(id)sender didFirstVisuallyNonEmptyLayoutInFrame:(id)frame {
436 [document_ webView:sender didFirstVisuallyNonEmptyLayoutInFrame:frame];
439 - (void) webView:(id)sender saveStateToHistoryItem:(id)item forFrame:(id)frame {
440 [document_ webView:sender saveStateToHistoryItem:item forFrame:frame];
443 - (void) webView:(id)sender restoreStateFromHistoryItem:(id)item forFrame:(id)frame force:(BOOL)force {
444 [document_ webView:sender restoreStateFromHistoryItem:item forFrame:frame force:force];
447 - (void) webView:(id)sender attachRootLayer:(id)layer {
448 [document_ webView:sender attachRootLayer:layer];
451 - (id) webView:(id)sender plugInViewWithArguments:(id)arguments fromPlugInPackage:(id)package {
452 return [document_ webView:sender plugInViewWithArguments:arguments fromPlugInPackage:package];
455 - (void) webView:(id)sender willShowFullScreenForPlugInView:(id)view {
456 [document_ webView:sender willShowFullScreenForPlugInView:view];
459 - (void) webView:(id)sender didHideFullScreenForPlugInView:(id)view {
460 [document_ webView:sender didHideFullScreenForPlugInView:view];
463 - (void) webView:(id)sender willAddPlugInView:(id)view {
464 [document_ webView:sender willAddPlugInView:view];
467 - (void) webView:(id)sender didObserveDeferredContentChange:(int)change forFrame:(id)frame {
468 [document_ webView:sender didObserveDeferredContentChange:change forFrame:frame];
471 - (void) webViewDidPreventDefaultForEvent:(id)sender {
472 [document_ webViewDidPreventDefaultForEvent:sender];
475 - (void) _setTileDrawingEnabled:(BOOL)enabled {
476 //[document_ setTileDrawingEnabled:enabled];
479 - (void) willStartGesturesInView:(UIView *)view forEvent:(GSEventRef)event {
480 [self _setTileDrawingEnabled:NO];
483 - (void) didFinishGesturesInView:(UIView *)view forEvent:(GSEventRef)event {
484 [self _setTileDrawingEnabled:YES];
485 [document_ redrawScaledDocument];
488 - (void) setViewportWidth:(float)width {
489 width_ = width != 0 ? width : [[self class] defaultWidth];
490 [document_ setViewportSize:CGSizeMake(width_, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10];
493 - (void) scrollerWillStartDragging:(UIScroller *)scroller {
494 [self _setTileDrawingEnabled:NO];
497 - (void) scrollerDidEndDragging:(UIScroller *)scroller willSmoothScroll:(BOOL)smooth {
498 [self _setTileDrawingEnabled:YES];
501 - (void) scrollerDidEndDragging:(UIScroller *)scroller {
502 [self _setTileDrawingEnabled:YES];
505 - (void) loadRequest:(NSURLRequest *)request {
509 [document_ loadRequest:request];
513 - (void) loadURL:(NSURL *)url cachePolicy:(NSURLRequestCachePolicy)policy {
514 [self loadRequest:[NSURLRequest
521 - (void) loadURL:(NSURL *)url {
522 [self loadURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy];
526 CGRect frame = {{0, 0}, {320, 480}};
527 frame.size.height -= 20; //[[[$SBStatusBarController sharedStatusBarController] statusBarView] frame].size.height;
529 if ((self = [super initWithFrame:frame]) != nil) {
530 loading_ = [[NSMutableSet alloc] initWithCapacity:3];
532 struct CGRect bounds([self bounds]);
534 scroller_ = [[objc_getClass(Wildcat_ ? "UIScrollView" : "UIScroller") alloc] initWithFrame:bounds];
535 [self addSubview:scroller_];
537 [scroller_ setFixedBackgroundPattern:YES];
538 [scroller_ setBackgroundColor:[UIColor blackColor]];
540 [scroller_ setScrollingEnabled:YES];
541 [scroller_ setClipsSubviews:YES];
544 [scroller_ setAllowsRubberBanding:YES];
546 [scroller_ setDelegate:self];
547 [scroller_ setBounces:YES];
550 [scroller_ setScrollHysteresis:8];
551 [scroller_ setThumbDetectionEnabled:NO];
552 [scroller_ setDirectionalScrolling:YES];
553 //[scroller_ setScrollDecelerationFactor:0.99]; /* 0.989324 */
554 [scroller_ setEventMode:YES];
558 UIScrollView *scroller((UIScrollView *)scroller_);
559 //[scroller setDirectionalLockEnabled:NO];
560 [scroller setDelaysContentTouches:NO];
561 //[scroller setScrollsToTop:NO];
562 //[scroller setCanCancelContentTouches:NO];
565 [scroller_ setShowBackgroundShadow:NO]; /* YES */
566 //[scroller_ setAllowsRubberBanding:YES]; /* Vertical */
569 [scroller_ setAdjustForContentSizeChange:YES]; /* NO */
571 CGRect rect([scroller_ bounds]);
572 //rect.size.height = 0;
576 document_ = [[UIWebDocumentView alloc] initWithFrame:rect];
577 WebView *webview([document_ webView]);
579 [document_ setBackgroundColor:[UIColor blackColor]];
580 if ([document_ respondsToSelector:@selector(setDrawsBackground:)])
581 [document_ setDrawsBackground:NO];
582 [webview setDrawsBackground:NO];
584 [webview setPreferencesIdentifier:@"WebCycript"];
586 [document_ setTileSize:CGSizeMake(rect.size.width, 500)];
588 if ([document_ respondsToSelector:@selector(enableReachability)])
589 [document_ enableReachability];
590 if ([document_ respondsToSelector:@selector(setAllowsMessaging:)])
591 [document_ setAllowsMessaging:YES];
592 if ([document_ respondsToSelector:@selector(useSelectionAssistantWithMode:)])
593 [document_ useSelectionAssistantWithMode:0];
595 [document_ setTilingEnabled:YES];
596 [document_ setDrawsGrid:NO];
597 [document_ setLogsTilingChanges:NO];
598 [document_ setTileMinificationFilter:kCAFilterNearest];
600 if ([document_ respondsToSelector:@selector(setDataDetectorTypes:)])
601 /* XXX: abstractify */
602 [document_ setDataDetectorTypes:0x80000000];
604 [document_ setDetectsPhoneNumbers:NO];
606 [document_ setAutoresizes:YES];
608 [document_ setMinimumScale:0.25f forDocumentTypes:0x10];
609 [document_ setMaximumScale:5.00f forDocumentTypes:0x10];
610 [document_ setInitialScale:UIWebViewScalesToFitScale forDocumentTypes:0x10];
611 //[document_ setViewportSize:CGSizeMake(980, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10];
613 [document_ setViewportSize:CGSizeMake(320, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x2];
615 [document_ setMinimumScale:1.00f forDocumentTypes:0x8];
616 [document_ setInitialScale:UIWebViewScalesToFitScale forDocumentTypes:0x8];
617 [document_ setViewportSize:CGSizeMake(320, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x8];
619 [document_ _setDocumentType:0x4];
621 if ([document_ respondsToSelector:@selector(setZoomsFocusedFormControl:)])
622 [document_ setZoomsFocusedFormControl:YES];
623 [document_ setContentsPosition:7];
624 [document_ setEnabledGestures:0xa];
625 [document_ setValue:[NSNumber numberWithBool:YES] forGestureAttribute:UIGestureAttributeIsZoomRubberBandEnabled];
626 [document_ setValue:[NSNumber numberWithBool:YES] forGestureAttribute:UIGestureAttributeUpdatesScroller];
628 [document_ setSmoothsFonts:YES];
629 [document_ setAllowsImageSheet:YES];
630 [webview _setUsesLoaderCache:YES];
632 [webview setGroupName:@"CydgetGroup"];
634 WebPreferences *preferences([webview preferences]);
636 if ([webview respondsToSelector:@selector(_setLayoutInterval:)])
637 [webview _setLayoutInterval:0];
639 [preferences _setLayoutInterval:0];
641 [self setViewportWidth:0];
643 [document_ setDelegate:self];
644 [document_ setGestureDelegate:self];
646 if ([document_ respondsToSelector:@selector(setFormEditingDelegate:)])
647 [document_ setFormEditingDelegate:self];
648 [document_ setInteractionDelegate:self];
650 [scroller_ addSubview:document_];
652 //NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
654 indirect_ = [[WebCycriptDelegate alloc] initWithDelegate:self];
656 [webview setFrameLoadDelegate:indirect_];
657 [webview setPolicyDelegate:indirect_];
658 [webview setResourceLoadDelegate:indirect_];
659 [webview setUIDelegate:indirect_];
661 /* XXX: do not turn this on under penalty of extreme pain */
662 [webview setScriptDebugDelegate:nil];
666 CGSize indsize([UIProgressIndicator defaultSizeForStyle:UIProgressIndicatorStyleMediumWhite]);
667 indicator_ = [[UIProgressIndicator alloc] initWithFrame:CGRectMake(281, 12, indsize.width, indsize.height)];
668 [indicator_ setStyle:UIProgressIndicatorStyleMediumWhite];
670 [self setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
671 [scroller_ setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
673 NSDictionary *configuration([$CydgetController currentConfiguration]);
675 cycript_ = [configuration objectForKey:@"CycriptURLs"];
677 scrollable_ = [[configuration objectForKey:@"Scrollable"] boolValue];
678 [scroller_ setScrollingEnabled:scrollable_];
680 NSString *homepage([configuration objectForKey:@"Homepage"]);
681 [self loadURL:[NSURL URLWithString:homepage]];
683 /*[UIKeyboard initImplementationNow];
684 CGSize keysize = [UIKeyboard defaultSize];
685 CGRect keyrect = {{0, [self bounds].size.height - 100}, keysize};
686 keyboard_ = [[UIKeyboard alloc] initWithFrame:keyrect];
687 [self addSubview:keyboard_];
689 [self addSubview:[[UITextView alloc] initWithFrame:CGRectMake(200, 0, 100, 100)]];
690 [self addSubview:[[UITextView alloc] initWithFrame:CGRectMake(200, 150, 100, 100)]];
691 [self addSubview:[[UITextView alloc] initWithFrame:CGRectMake(200, 300, 100, 100)]];*/
695 - (void) webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
698 UIActionSheet *sheet = [[[UIActionSheet alloc]
700 buttons:[NSArray arrayWithObjects:@"OK", nil]
706 [sheet setBodyText:message];
707 [sheet popupAlertAnimated:YES];
710 - (BOOL) webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
713 UIActionSheet *sheet = [[[UIActionSheet alloc]
715 buttons:[NSArray arrayWithObjects:@"OK", @"CANCEL", nil]
721 [sheet setNumberOfRows:1];
722 [sheet setBodyText:message];
723 [sheet popupAlertAnimated:YES];
725 NSRunLoop *loop([NSRunLoop currentRunLoop]);
726 NSDate *future([NSDate distantFuture]);
728 while (confirm_ == nil && [loop runMode:NSDefaultRunLoopMode beforeDate:future]);
730 NSNumber *confirm([confirm_ autorelease]);
734 return [confirm boolValue];
737 /* XXX: WebThreadLock? */
738 - (void) _fixScroller:(CGRect)bounds {
740 if (!editing_ || $UIFormAssistant == nil)
743 UIFormAssistant *assistant([$UIFormAssistant sharedFormAssistant]);
744 CGRect peripheral([assistant peripheralFrame]);
745 extra = peripheral.size.height;
748 CGRect subrect([scroller_ frame]);
749 subrect.size.height -= [TPBottomLockBar defaultHeight];
750 subrect.size.height -= extra;
752 if ([scroller_ respondsToSelector:@selector(setScrollerIndicatorSubrect:)])
753 [scroller_ setScrollerIndicatorSubrect:subrect];
755 [document_ setValue:[NSValue valueWithSize:NSMakeSize(subrect.size.width, subrect.size.height)] forGestureAttribute:UIGestureAttributeVisibleSize];
758 size.height += extra;
759 size.height += [TPBottomLockBar defaultHeight];
760 [scroller_ setContentSize:size];
762 if ([scroller_ respondsToSelector:@selector(releaseRubberBandIfNecessary)])
763 [scroller_ releaseRubberBandIfNecessary];
766 - (void) fixScroller {
767 CGRect bounds([document_ documentBounds]);
768 [self _fixScroller:bounds];
771 - (void) view:(UIView *)sender didSetFrame:(CGRect)frame {
773 [self _fixScroller:frame];
776 - (void) view:(UIView *)sender didSetFrame:(CGRect)frame oldFrame:(CGRect)old {
777 [self view:sender didSetFrame:frame];
780 - (void) formAssistant:(id)sender didBeginEditingFormNode:(id)node {
783 - (void) formAssistant:(id)sender didEndEditingFormNode:(id)node {
787 - (void) webView:(WebView *)sender willBeginEditingFormElement:(id)element {
791 - (void) webView:(WebView *)sender didBeginEditingFormElement:(id)element {
795 - (void) webViewDidEndEditingFormElements:(WebView *)sender {
800 - (void) webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame {
802 if (NSString *href = [[[[frame dataSource] request] URL] absoluteString])
803 if (Pcre([cycript_ UTF8String], 0 /*XXX:PCRE_UTF8*/)(href))
804 if (void *handle = dlopen("/usr/lib/libcycript.dylib", RTLD_LAZY | RTLD_GLOBAL))
805 if (void (*CYSetupContext)(JSGlobalContextRef) = reinterpret_cast<void (*)(JSGlobalContextRef)>(dlsym(handle, "CydgetSetupContext"))) {
806 WebView *webview([document_ webView]);
807 WebFrame *frame([webview mainFrame]);
808 JSGlobalContextRef context([frame globalContext]);
809 CYSetupContext(context);
814 return [loading_ count] != 0;
817 - (void) reloadButtons {
818 if ([self isLoading]) {
819 [UIApp setNetworkActivityIndicatorVisible:YES];
820 [indicator_ startAnimation];
822 [UIApp setNetworkActivityIndicatorVisible:NO];
823 [indicator_ stopAnimation];
827 - (void) _finishLoading {
828 size_t count([loading_ count]);
830 [self autorelease];*/
831 if (reloading_ || count != 0)
833 [self reloadButtons];
836 - (BOOL) webView:(WebView *)sender shouldScrollToPoint:(struct CGPoint)point forFrame:(WebFrame *)frame {
837 return [document_ webView:sender shouldScrollToPoint:point forFrame:frame];
840 - (void) webView:(WebView *)sender didReceiveViewportArguments:(id)arguments forFrame:(WebFrame *)frame {
841 return [document_ webView:sender didReceiveViewportArguments:arguments forFrame:frame];
844 - (void) webView:(WebView *)sender needsScrollNotifications:(id)notifications forFrame:(WebFrame *)frame {
845 return [document_ webView:sender needsScrollNotifications:notifications forFrame:frame];
848 - (void) webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame {
849 return [document_ webView:sender didCommitLoadForFrame:frame];
852 - (void) webView:(WebView *)sender didReceiveDocTypeForFrame:(WebFrame *)frame {
853 return [document_ webView:sender didReceiveDocTypeForFrame:frame];
856 - (void) webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
857 [loading_ removeObject:[NSValue valueWithNonretainedObject:frame]];
858 [self _finishLoading];
859 return [document_ webView:sender didFinishLoadForFrame:frame];
862 - (void) webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame {
863 /*if ([loading_ count] == 0)
865 [loading_ addObject:[NSValue valueWithNonretainedObject:frame]];
867 if ([frame parentFrame] == nil) {
868 [document_ resignFirstResponder];
873 CGRect webrect = [scroller_ bounds];
874 webrect.size.height = 1;
875 [document_ setFrame:webrect];
878 if ([scroller_ respondsToSelector:@selector(scrollPointVisibleAtTopLeft:)])
879 [scroller_ scrollPointVisibleAtTopLeft:CGPointZero];
881 [scroller_ scrollRectToVisible:CGRectZero animated:NO];
883 if ([scroller_ respondsToSelector:@selector(setZoomScale:duration:)])
884 [scroller_ setZoomScale:1 duration:0];
885 else if ([scroller_ respondsToSelector:@selector(_setZoomScale:duration:)])
886 [scroller_ _setZoomScale:1 duration:0];
887 /*else if ([scroller_ respondsToSelector:@selector(setZoomScale:animated:)])
888 [scroller_ setZoomScale:1 animated:NO];*/
891 CGRect webrect = [scroller_ bounds];
892 webrect.size.height = 1;
893 [document_ setFrame:webrect];
897 [self reloadButtons];
900 - (void) _didFailWithError:(NSError *)error forFrame:(WebFrame *)frame {
901 /*if ([frame parentFrame] == nil)
902 [self autorelease];*/
904 [loading_ removeObject:[NSValue valueWithNonretainedObject:frame]];
905 [self _finishLoading];
910 if ([frame parentFrame] == nil) {
911 [self loadURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@?%@",
912 [[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"error" ofType:@"html"]] absoluteString],
913 [[error localizedDescription] stringByAddingPercentEscapes]
920 - (void) webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame {
921 [self _didFailWithError:error forFrame:frame];
922 if ([document_ respondsToSelector:@selector(webView:didFailLoadWithError:forFrame:)])
923 [document_ webView:sender didFailLoadWithError:error forFrame:frame];
926 - (void) webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame {
927 [self _didFailWithError:error forFrame:frame];
930 - (void) webView:(WebView *)sender addMessageToConsole:(NSDictionary *)dictionary {
931 fprintf(stderr, "Console:%s\n", [[dictionary description] UTF8String]);
936 @interface WebCycriptLockScreenController : SBAwayViewPluginController {
943 static bool cycript_;
944 static bool jscript_;
946 static void SetParser(bool cycript, bool jscript) {
951 static bool GetParser0() {
955 static bool GetParser1() {
959 static void Cycriptify(apr_pool_t *pool, const uint16_t *&data, size_t &size) {
960 if (void *handle = dlopen("/usr/lib/libcycript.dylib", RTLD_LAZY | RTLD_GLOBAL))
961 if (void (*CYParseUChar)(apr_pool_t *, const uint16_t **, size_t *) = reinterpret_cast<void (*)(apr_pool_t *, const uint16_t **, size_t *)>(dlsym(handle, "CydgetPoolParse")))
962 CYParseUChar(pool, &data, &size);
965 extern "C" void *_ZN3JSC7UString3Rep14nullBaseStringE __attribute__((__weak_import__));
966 extern "C" void *_ZN3JSC7UString3Rep7destroyEv __attribute__((__weak_import__));
967 extern "C" void *_ZN3JSC7UStringC1EPKti __attribute__((__weak_import__));
968 extern "C" void *_ZN3JSC7UStringC1EPKc __attribute__((__weak_import__));
969 extern "C" void *_ZNK3JSC7UString6substrEii __attribute__((__weak_import__));
970 extern "C" void *_ZN3WTF10fastMallocEm __attribute__((__weak_import__));
971 extern "C" void WTFReportAssertionFailure(const char *, int, const char *, const char *) __attribute__((__weak_import__));
972 extern "C" void *_ZN3WTF8fastFreeEPv __attribute__((__weak_import__));
976 &_ZN3JSC7UString3Rep14nullBaseStringE == NULL ||
977 &_ZN3JSC7UString3Rep7destroyEv == NULL ||
978 &_ZN3JSC7UStringC1EPKti == NULL ||
979 &_ZN3JSC7UStringC1EPKc == NULL ||
980 &_ZNK3JSC7UString6substrEii == NULL ||
981 &_ZN3WTF10fastMallocEm == NULL ||
982 &WTFReportAssertionFailure == NULL ||
983 &_ZN3WTF8fastFreeEPv == NULL ||
987 MSHook(void, _ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE, JSC::SourceCode **_this, JSC::JSGlobalData *global, int *line, JSC::UString *message) {
989 return __ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE(_this, global, line, message);
991 SetParser(false, true);
993 JSC::SourceCode *source(*_this);
994 const uint16_t *data(source->data());
995 size_t size(source->length());
998 apr_pool_create(&pool, NULL);
1000 Cycriptify(pool, data, size);
1001 source->~SourceCode();
1002 new (source) JSC::SourceCode(JSC::UStringSourceProvider::create(JSC::UString(data, size), "cycript://"), 1);
1004 apr_pool_destroy(pool);
1006 __ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE(_this, global, line, message);
1010 MSHook(void, _ZN3KJS6Parser5parseEiPKNS_5UCharEjPiS4_PNS_7UStringE, void *_this, int start, const UChar *code, unsigned length, int *source, int *line, JSC::UString *message) {
1012 return __ZN3KJS6Parser5parseEiPKNS_5UCharEjPiS4_PNS_7UStringE(_this, start, code, length, source, line, message);
1014 const uint16_t *data(code);
1015 size_t size(length);
1018 apr_pool_create(&pool, NULL);
1020 Cycriptify(pool, data, size);
1021 __ZN3KJS6Parser5parseEiPKNS_5UCharEjPiS4_PNS_7UStringE(_this, start, data, size, source, line, message);
1023 apr_pool_destroy(pool);
1031 MSHook(State, _ZN7WebCore13HTMLTokenizer13scriptHandlerENS0_5StateE, State state) {
1032 SetParser(false, true);
1033 state = __ZN7WebCore13HTMLTokenizer13scriptHandlerENS0_5StateE(state);
1034 SetParser(false, false);
1038 MSHook(void, _ZN7WebCore13HTMLTokenizer14notifyFinishedEPNS_14CachedResourceE, void *resource) {
1039 SetParser(false, true);
1040 __ZN7WebCore13HTMLTokenizer14notifyFinishedEPNS_14CachedResourceE(resource);
1041 SetParser(false, false);
1044 MSHook(bool, _ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE, const WebCore::String &mime) {
1045 if (!GetParser1() || mime != "text/cycript")
1046 return __ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE(mime);
1048 static void *handle(dlopen("/usr/lib/libcycript.dylib", RTLD_LAZY | RTLD_GLOBAL));
1052 SetParser(true, true);
1056 /* Cydget:// Protocol {{{ */
1057 @interface CydgetURLProtocol : NSURLProtocol {
1062 @implementation CydgetURLProtocol
1064 + (BOOL) canInitWithRequest:(NSURLRequest *)request {
1065 NSURL *url([request URL]);
1068 NSString *scheme([[url scheme] lowercaseString]);
1069 if (scheme == nil || ![scheme isEqualToString:@"cydget"])
1074 + (NSURLRequest *) canonicalRequestForRequest:(NSURLRequest *)request {
1078 - (void) _returnPNGWithImage:(UIImage *)icon forRequest:(NSURLRequest *)request {
1079 id<NSURLProtocolClient> client([self client]);
1081 [client URLProtocol:self didFailWithError:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorFileDoesNotExist userInfo:nil]];
1083 NSData *data(UIImagePNGRepresentation(icon));
1085 NSURLResponse *response([[[NSURLResponse alloc] initWithURL:[request URL] MIMEType:@"image/png" expectedContentLength:-1 textEncodingName:nil] autorelease]);
1086 [client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
1087 [client URLProtocol:self didLoadData:data];
1088 [client URLProtocolDidFinishLoading:self];
1092 - (void) startLoading {
1093 id<NSURLProtocolClient> client([self client]);
1094 NSURLRequest *request([self request]);
1096 NSURL *url([request URL]);
1097 NSString *href([url absoluteString]);
1099 NSString *path([href substringFromIndex:9]);
1100 NSRange slash([path rangeOfString:@"/"]);
1103 if (slash.location == NSNotFound) {
1107 command = [path substringToIndex:slash.location];
1108 path = [path substringFromIndex:(slash.location + 1)];
1111 if ([command isEqualToString:@"_UIImageWithName"]) {
1114 path = [path stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
1115 UIImage *icon(_UIImageWithName(path));
1116 [self _returnPNGWithImage:icon forRequest:request];
1118 [client URLProtocol:self didFailWithError:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorResourceUnavailable userInfo:nil]];
1122 - (void) stopLoading {
1127 /* Cydget-CGI:// Protocol {{{ */
1128 @interface CydgetCGIURLProtocol : NSURLProtocol {
1130 CFHTTPMessageRef http_;
1131 NSFileHandle *handle_;
1136 @implementation CydgetCGIURLProtocol
1138 + (BOOL) canInitWithRequest:(NSURLRequest *)request {
1139 NSURL *url([request URL]);
1142 NSString *scheme([[url scheme] lowercaseString]);
1143 if (scheme == nil || ![scheme isEqualToString:@"cydget-cgi"])
1148 + (NSURLRequest *) canonicalRequestForRequest:(NSURLRequest *)request {
1152 - (id) initWithRequest:(NSURLRequest *)request cachedResponse:(NSCachedURLResponse *)response client:(id<NSURLProtocolClient>)client {
1153 if ((self = [super initWithRequest:request cachedResponse:response client:client]) != nil) {
1158 - (void) startLoading {
1159 id<NSURLProtocolClient> client([self client]);
1160 NSURLRequest *request([self request]);
1161 NSURL *url([request URL]);
1163 NSString *path([url path]);
1165 [client URLProtocol:self didFailWithError:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorResourceUnavailable userInfo:nil]];
1169 NSFileManager *manager([NSFileManager defaultManager]);
1170 if (![manager fileExistsAtPath:path]) {
1171 [client URLProtocol:self didFailWithError:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorFileDoesNotExist userInfo:nil]];
1176 _assert(pipe(fds) != -1);
1178 _assert(pid_ == -1);
1181 _assert(close(fds[0]) != -1);
1182 _assert(close(fds[1]) != -1);
1183 [client URLProtocol:self didFailWithError:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorResourceUnavailable userInfo:nil]];
1188 const char *script([path UTF8String]);
1190 setenv("GATEWAY_INTERFACE", "CGI/1.1", true);
1191 setenv("SCRIPT_FILENAME", script, true);
1192 NSString *query([url query]);
1194 setenv("QUERY_STRING", [query UTF8String], true);
1196 _assert(dup2(fds[1], 1) != -1);
1197 _assert(close(fds[0]) != -1);
1198 _assert(close(fds[1]) != -1);
1200 execl(script, script, NULL);
1205 _assert(close(fds[1]) != -1);
1207 _assert(http_ == NULL);
1208 http_ = CFHTTPMessageCreateEmpty(kCFAllocatorDefault, FALSE);
1209 CFHTTPMessageAppendBytes(http_, (const uint8_t *) "HTTP/1.1 200 OK\r\n", 17);
1211 _assert(handle_ == nil);
1212 handle_ = [[NSFileHandle alloc] initWithFileDescriptor:fds[0] closeOnDealloc:YES];
1214 [[NSNotificationCenter defaultCenter]
1216 selector:@selector(onRead:)
1217 name:@"NSFileHandleReadCompletionNotification"
1221 [handle_ readInBackgroundAndNotify];
1224 - (void) onRead:(NSNotification *)notification {
1225 NSFileHandle *handle([notification object]);
1227 NSData *data([[notification userInfo] objectForKey:NSFileHandleNotificationDataItem]);
1229 if (size_t length = [data length]) {
1230 CFHTTPMessageAppendBytes(http_, reinterpret_cast<const UInt8 *>([data bytes]), length);
1231 [handle readInBackgroundAndNotify];
1233 id<NSURLProtocolClient> client([self client]);
1235 CFStringRef mime(CFHTTPMessageCopyHeaderFieldValue(http_, CFSTR("Content-type")));
1237 [client URLProtocol:self didFailWithError:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorBadServerResponse userInfo:nil]];
1239 NSURLRequest *request([self request]);
1241 NSURLResponse *response([[[NSURLResponse alloc] initWithURL:[request URL] MIMEType:(NSString *)mime expectedContentLength:-1 textEncodingName:nil] autorelease]);
1244 [client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
1246 CFDataRef body(CFHTTPMessageCopyBody(http_));
1247 [client URLProtocol:self didLoadData:(NSData *)body];
1250 [client URLProtocolDidFinishLoading:self];
1258 //[client URLProtocol:self didFailWithError:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorNetworkConnectionLost userInfo:nil]];
1260 - (void) stopLoading_ {
1261 [[NSNotificationCenter defaultCenter] removeObserver:self];
1263 if (handle_ != nil) {
1269 kill(pid_, SIGTERM);
1271 _syscall(waitpid(pid_, &status, 0));
1276 - (void) stopLoading {
1278 performSelectorOnMainThread:@selector(stopLoading_)
1287 template <typename Type_>
1288 static void nlset(Type_ &function, struct nlist *nl, size_t index) {
1289 struct nlist &name(nl[index]);
1290 uintptr_t value(name.n_value);
1291 if ((name.n_desc & N_ARM_THUMB_DEF) != 0)
1292 value |= 0x00000001;
1293 function = reinterpret_cast<Type_>(value);
1296 template <typename Type_>
1297 static void dlset(Type_ &function, const char *name) {
1298 function = reinterpret_cast<Type_>(dlsym(RTLD_DEFAULT, name));
1301 @implementation WebCycriptLockScreenController
1303 + (void) initialize {
1305 size_t size(sizeof(maxproc));
1306 if (sysctlbyname("kern.maxproc", &maxproc, &size, NULL, 0) == -1)
1307 NSLog(@"sysctlbyname(\"kern.maxproc\", ?)");
1308 else if (maxproc < 72) {
1310 if (sysctlbyname("kern.maxproc", NULL, NULL, &maxproc, sizeof(maxproc)) == -1)
1311 NSLog(@"sysctlbyname(\"kern.maxproc\", #)");
1316 [NSURLProtocol registerClass:[CydgetURLProtocol class]];
1317 [NSURLProtocol registerClass:[CydgetCGIURLProtocol class]];
1319 void (*_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE)(JSC::SourceCode **, JSC::JSGlobalData *, int *, JSC::UString *);
1320 dlset(_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE, "_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE");
1321 if (_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE != NULL)
1322 MSHookFunction(_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE, MSHake(_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE));
1324 void (*_ZN3KJS6Parser5parseEiPKNS_5UCharEjPiS4_PNS_7UStringE)(void *, int, const UChar *, unsigned, int *, int *, JSC::UString *);
1325 dlset(_ZN3KJS6Parser5parseEiPKNS_5UCharEjPiS4_PNS_7UStringE, "_ZN3KJS6Parser5parseEiPKNS_5UCharEjPiS4_PNS_7UStringE");
1326 if (_ZN3KJS6Parser5parseEiPKNS_5UCharEjPiS4_PNS_7UStringE != NULL)
1327 MSHookFunction(_ZN3KJS6Parser5parseEiPKNS_5UCharEjPiS4_PNS_7UStringE, MSHake(_ZN3KJS6Parser5parseEiPKNS_5UCharEjPiS4_PNS_7UStringE));
1330 memset(nl, 0, sizeof(nl));
1331 nl[0].n_un.n_name = (char *) "__ZN7WebCore13HTMLTokenizer13scriptHandlerENS0_5StateE";
1332 nl[1].n_un.n_name = (char *) "__ZN7WebCore13HTMLTokenizer14notifyFinishedEPNS_14CachedResourceE";
1333 nl[2].n_un.n_name = (char *) "__ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE";
1334 nlist("/System/Library/PrivateFrameworks/WebCore.framework/WebCore", nl);
1336 State (*_ZN7WebCore13HTMLTokenizer13scriptHandlerENS0_5StateE)(State);
1337 nlset(_ZN7WebCore13HTMLTokenizer13scriptHandlerENS0_5StateE, nl, 0);
1338 MSHookFunction(_ZN7WebCore13HTMLTokenizer13scriptHandlerENS0_5StateE, MSHake(_ZN7WebCore13HTMLTokenizer13scriptHandlerENS0_5StateE));
1340 void (*_ZN7WebCore13HTMLTokenizer14notifyFinishedEPNS_14CachedResourceE)(void *);
1341 nlset(_ZN7WebCore13HTMLTokenizer14notifyFinishedEPNS_14CachedResourceE, nl, 1);
1342 MSHookFunction(_ZN7WebCore13HTMLTokenizer14notifyFinishedEPNS_14CachedResourceE, MSHake(_ZN7WebCore13HTMLTokenizer14notifyFinishedEPNS_14CachedResourceE));
1344 bool (*_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE)(const WebCore::String &);
1345 nlset(_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE, nl, 2);
1346 MSHookFunction(_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE, MSHake(_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE));
1349 + (id) rootViewController {
1350 return [[[self alloc] init] autorelease];
1354 [self setView:[[[WebCydgetLockScreenView alloc] init] autorelease]];