]> git.saurik.com Git - cydget.git/blobdiff - LockScreen.mm
Stop taking away my keyboard!
[cydget.git] / LockScreen.mm
index 30286f040ae620359edbf0a17bed1efa9f3d80dc..56999ca36c636d8f9d1ccb5b816c7c12e1737fd2 100644 (file)
@@ -1,5 +1,5 @@
-/* CydgetScript - open-source IntelliDial replacement
- * Copyright (C) 2009  Jay Freeman (saurik)
+/* Cydget - open-source AwayView plugin multiplexer
+ * Copyright (C) 2009-2011  Jay Freeman (saurik)
 */
 
 /*
@@ -78,14 +78,6 @@ extern NSString * const kCAFilterNearest;
 #include <apr-1/apr_pools.h>
 #include <pcre.h>
 
-@interface WebView (UICaboodle)
-- (void) setScriptDebugDelegate:(id)delegate;
-- (void) _setFormDelegate:(id)delegate;
-- (void) _setUIKitDelegate:(id)delegate;
-- (void) setWebMailDelegate:(id)delegate;
-- (void) _setLayoutInterval:(float)interval;
-@end
-
 #define _transient
 #define _forever for (;;)
 
@@ -119,11 +111,8 @@ while (false)
 @end
 
 static Class $CydgetController(objc_getClass("CydgetController"));
-static Class $UIFormAssistant(objc_getClass("UIFormAssistant"));
-//static Class $SBStatusBarController(objc_getClass("SBStatusBarController"));
 
-static Class $UIWebBrowserView;
-static bool Wildcat_, iOS4;
+static bool iOS32, iOS4;
 
 @interface NSString (UIKit)
 - (NSString *) stringByAddingPercentEscapes;
@@ -199,127 +188,63 @@ class Pcre {
     }
 };
 /* }}} */
-/* WebCycript Delegate {{{ */
-@interface WebCycriptDelegate : NSObject {
-    _transient volatile id delegate_;
-}
 
-- (void) setDelegate:(id)delegate;
-- (id) initWithDelegate:(id)delegate;
-@end
+static float CYScrollViewDecelerationRateNormal;
 
-@implementation WebCycriptDelegate
-
-- (void) setDelegate:(id)delegate {
-    delegate_ = delegate;
-}
+@interface UIScrollView (Apple)
+- (void) setDecelerationRate:(float)value;
+- (void) setScrollingEnabled:(BOOL)enabled;
+@end
 
-- (id) initWithDelegate:(id)delegate {
-    delegate_ = delegate;
-    return self;
-}
+@interface UIWebView (Apple)
+- (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
 
-- (void) webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame {
-    if (delegate_ != nil)
-        return [delegate_ webView:sender didClearWindowObject:window forFrame:frame];
-}
+@interface WebView (Apple)
+- (void) _setLayoutInterval:(float)interval;
+- (void) _setAllowsMessaging:(BOOL)allows;
+- (void) setShouldUpdateWhileOffscreen:(BOOL)update;
+@end
 
-- (void) webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame {
-    if (delegate_ != nil)
-        return [delegate_ webView:sender didCommitLoadForFrame:frame];
-}
+@protocol CydgetWebViewDelegate //<UIWebViewDelegate>
+- (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame;
+@end
 
-- (void) webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame {
-    if (delegate_ != nil)
-        return [delegate_ webView:sender didFailLoadWithError:error forFrame:frame];
-}
+@class UIWebViewWebViewDelegate;
 
-- (void) webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame {
-    if (delegate_ != nil)
-        return [delegate_ webView:sender didFailProvisionalLoadWithError:error forFrame:frame];
+@interface CydgetWebView : UIWebView {
 }
 
-- (void) webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
-    if (delegate_ != nil)
-        return [delegate_ webView:sender didFinishLoadForFrame:frame];
-}
-
-/*- (void) webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame {
-    if (delegate_ != nil)
-        return [delegate_ webView:sender didReceiveTitle:title forFrame:frame];
-}*/
-
-- (void) webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame {
-    if (delegate_ != nil)
-        return [delegate_ webView:sender didStartProvisionalLoadForFrame:frame];
-}
+@end
 
-/*- (void) webView:(WebView *)sender resource:(id)identifier didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)source {
-    if (delegate_ != nil)
-        return [delegate_ webView:sender resource:identifier didReceiveAuthenticationChallenge:challenge fromDataSource:source];
-}*/
-
-/*- (NSURLRequest *) webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)source {
-    if (delegate_ != nil)
-        return [delegate_ webView:sender resource:identifier willSendRequest:request redirectResponse:redirectResponse fromDataSource:source];
-    return nil;
-}*/
-
-- (IMP) methodForSelector:(SEL)sel {
-    if (IMP method = [super methodForSelector:sel])
-        return method;
-    fprintf(stderr, "methodForSelector:[%s] == NULL\n", sel_getName(sel));
-    return NULL;
-}
+@implementation CydgetWebView
 
-- (BOOL) respondsToSelector:(SEL)sel {
-    if ([super respondsToSelector:sel])
-        return YES;
-    // XXX: WebThreadCreateNSInvocation returns nil
-    //fprintf(stderr, "[%s]R?%s\n", class_getName(self->isa), sel_getName(sel));
-    return delegate_ == nil ? NO : [delegate_ respondsToSelector:sel];
+- (void) webView:(WebView *)view decidePolicyForNavigationAction:(NSDictionary *)action request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener {
+    [listener use];
 }
 
-- (NSMethodSignature *) methodSignatureForSelector:(SEL)sel {
-    if (NSMethodSignature *method = [super methodSignatureForSelector:sel])
-        return method;
-    //fprintf(stderr, "[%s]S?%s\n", class_getName(self->isa), sel_getName(sel));
-    if (delegate_ != nil)
-        if (NSMethodSignature *sig = [delegate_ methodSignatureForSelector:sel])
-            return sig;
-    // XXX: I fucking hate Apple so very very bad
-    return [NSMethodSignature signatureWithObjCTypes:"v@:"];
+- (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame {
+    NSObject<CydgetWebViewDelegate> *delegate([self delegate]);
+    if ([delegate respondsToSelector:@selector(webView:didClearWindowObject:forFrame:)])
+        [delegate webView:view didClearWindowObject:window forFrame:frame];
+    if ([UIWebView instancesRespondToSelector:@selector(webView:didClearWindowObject:forFrame:)])
+        [super webView:view didClearWindowObject:window forFrame:frame];
 }
 
-- (void) forwardInvocation:(NSInvocation *)inv {
-    SEL sel = [inv selector];
-    if (delegate_ != nil && [delegate_ respondsToSelector:sel])
-        [inv invokeWithTarget:delegate_];
+- (void) webView:(WebView *)view addMessageToConsole:(NSDictionary *)message {
+    NSLog(@"addMessageToConsole:%@", message);
 }
 
 @end
-/* }}} */
 
 @interface WebCydgetLockScreenView : UIView {
-    WebCycriptDelegate *indirect_;
-    UIProgressIndicator *indicator_;
-    UIScroller *scroller_;
-    UIWebDocumentView *document_;
-
+    CydgetWebView *webview_;
+    UIScrollView *scroller_;
     NSString *cycript_;
-    bool scrollable_;
-
-    float width_;
-    CGSize size_;
-    bool editing_;
-
-    NSNumber *confirm_;
-
-    NSMutableSet *loading_;
-    bool error_;
-    bool reloading_;
-
-    //UIKeyboard *keyboard_;
 }
 
 @end
@@ -329,176 +254,13 @@ class Pcre {
 //#include "UICaboodle/UCInternal.h"
 
 - (void) dealloc {
-    WebThreadLock();
-
-    WebView *webview([document_ webView]);
-    [webview setFrameLoadDelegate:nil];
-    [webview setResourceLoadDelegate:nil];
-    [webview setUIDelegate:nil];
-    [webview setScriptDebugDelegate:nil];
-    [webview setPolicyDelegate:nil];
-
-    /* XXX: these are set by UIWebDocumentView
-    [webview setDownloadDelegate:nil];
-    [webview _setFormDelegate:nil];
-    [webview _setUIKitDelegate:nil];
-    [webview setEditingDelegate:nil];*/
-
-    /* XXX: no one sets this, ever
-    [webview setWebMailDelegate:nil];*/
-
-    [document_ setDelegate:nil];
-    [document_ setGestureDelegate:nil];
-
-    if ([document_ respondsToSelector:@selector(setFormEditingDelegate:)])
-        [document_ setFormEditingDelegate:nil];
-
-    [document_ setInteractionDelegate:nil];
-
-    [indirect_ setDelegate:nil];
-
-    [webview close];
-    [document_ release];
-
-    [indirect_ release];
-
-    WebThreadUnlock();
-
-    [scroller_ setDelegate:nil];
-
-    if (confirm_ != nil)
-        [confirm_ release];
-
-    //[keyboard_ release];
-
-    [scroller_ release];
-    [indicator_ release];
-    [loading_ release];
+    [webview_ setDelegate:nil];
+    [webview_ release];
     [super dealloc];
 }
 
-+ (float) defaultWidth {
-    return 980;
-}
-
-- (void) webView:(WebView *)sender didReceiveMessage:(NSDictionary *)dictionary {
-#if LogBrowser || ForSaurik
-    NSLog(@"Console:%@\n", [dictionary description]);
-#endif
-    if ([document_ respondsToSelector:@selector(webView:didReceiveMessage:)])
-        [document_ webView:sender didReceiveMessage:dictionary];
-}
-
-- (void) webView:(id)sender willCloseFrame:(id)frame {
-    if ([document_ respondsToSelector:@selector(webView:willCloseFrame:)])
-        [document_ webView:sender willCloseFrame:frame];
-}
-
-- (void) webView:(id)sender didFinishDocumentLoadForFrame:(id)frame {
-    if ([document_ respondsToSelector:@selector(webView:didFinishDocumentLoadForFrame:)])
-        [document_ webView:sender didFinishDocumentLoadForFrame:frame];
-}
-
-- (void) webView:(id)sender didFirstLayoutInFrame:(id)frame {
-    if ([document_ respondsToSelector:@selector(webView:didFirstLayoutInFrame:)])
-        [document_ webView:sender didFirstLayoutInFrame:frame];
-}
-
-- (void) webViewFormEditedStatusHasChanged:(id)changed {
-    if ([document_ respondsToSelector:@selector(webViewFormEditedStatusHasChanged:)])
-        [document_ webViewFormEditedStatusHasChanged:changed];
-}
-
-- (void) webView:(id)sender formStateDidFocusNode:(id)formState {
-    if ([document_ respondsToSelector:@selector(webView:formStateDidFocusNode:)])
-        [document_ webView:sender formStateDidFocusNode:formState];
-}
-
-- (void) webView:(id)sender formStateDidBlurNode:(id)formState {
-    if ([document_ respondsToSelector:@selector(webView:formStateDidBlurNode:)])
-        [document_ webView:sender formStateDidBlurNode:formState];
-}
-
-- (void) webViewDidLayout:(id)sender {
-    [document_ webViewDidLayout:sender];
-}
-
-- (void) webView:(id)sender didFirstVisuallyNonEmptyLayoutInFrame:(id)frame {
-    [document_ webView:sender didFirstVisuallyNonEmptyLayoutInFrame:frame];
-}
-
-- (void) webView:(id)sender saveStateToHistoryItem:(id)item forFrame:(id)frame {
-    [document_ webView:sender saveStateToHistoryItem:item forFrame:frame];
-}
-
-- (void) webView:(id)sender restoreStateFromHistoryItem:(id)item forFrame:(id)frame force:(BOOL)force {
-    [document_ webView:sender restoreStateFromHistoryItem:item forFrame:frame force:force];
-}
-
-- (void) webView:(id)sender attachRootLayer:(id)layer {
-    [document_ webView:sender attachRootLayer:layer];
-}
-
-- (id) webView:(id)sender plugInViewWithArguments:(id)arguments fromPlugInPackage:(id)package {
-    return [document_ webView:sender plugInViewWithArguments:arguments fromPlugInPackage:package];
-}
-
-- (void) webView:(id)sender willShowFullScreenForPlugInView:(id)view {
-    [document_ webView:sender willShowFullScreenForPlugInView:view];
-}
-
-- (void) webView:(id)sender didHideFullScreenForPlugInView:(id)view {
-    [document_ webView:sender didHideFullScreenForPlugInView:view];
-}
-
-- (void) webView:(id)sender willAddPlugInView:(id)view {
-    [document_ webView:sender willAddPlugInView:view];
-}
-
-- (void) webView:(id)sender didObserveDeferredContentChange:(int)change forFrame:(id)frame {
-    [document_ webView:sender didObserveDeferredContentChange:change forFrame:frame];
-}
-
-- (void) webViewDidPreventDefaultForEvent:(id)sender {
-    [document_ webViewDidPreventDefaultForEvent:sender];
-}
-
-- (void) _setTileDrawingEnabled:(BOOL)enabled {
-    //[document_ setTileDrawingEnabled:enabled];
-}
-
-- (void) willStartGesturesInView:(UIView *)view forEvent:(GSEventRef)event {
-    [self _setTileDrawingEnabled:NO];
-}
-
-- (void) didFinishGesturesInView:(UIView *)view forEvent:(GSEventRef)event {
-    [self _setTileDrawingEnabled:YES];
-    [document_ redrawScaledDocument];
-}
-
-- (void) setViewportWidth:(float)width {
-    width_ = width != 0 ? width : [[self class] defaultWidth];
-    [document_ setViewportSize:CGSizeMake(width_, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10];
-}
-
-- (void) scrollerWillStartDragging:(UIScroller *)scroller {
-    [self _setTileDrawingEnabled:NO];
-}
-
-- (void) scrollerDidEndDragging:(UIScroller *)scroller willSmoothScroll:(BOOL)smooth {
-    [self _setTileDrawingEnabled:YES];
-}
-
-- (void) scrollerDidEndDragging:(UIScroller *)scroller {
-    [self _setTileDrawingEnabled:YES];
-}
-
 - (void) loadRequest:(NSURLRequest *)request {
-    error_ = false;
-
-    WebThreadLock();
-    [document_ loadRequest:request];
-    WebThreadUnlock();
+    [webview_ loadRequest:request];
 }
 
 - (void) loadURL:(NSURL *)url cachePolicy:(NSURLRequestCachePolicy)policy {
@@ -518,433 +280,165 @@ class Pcre {
     frame.size.height -= 20; //[[[$SBStatusBarController sharedStatusBarController] statusBarView] frame].size.height;
 
     if ((self = [super initWithFrame:frame]) != nil) {
-        loading_ = [[NSMutableSet alloc] initWithCapacity:3];
-
-        struct CGRect bounds([self bounds]);
+        CGRect bounds([self bounds]);
+        bounds.size.height -= [TPBottomLockBar defaultHeight];
 
-        scroller_ = [[objc_getClass(Wildcat_ ? "UIScrollView" : "UIScroller") alloc] initWithFrame:bounds];
-        [self addSubview:scroller_];
+        webview_ = [[CydgetWebView alloc] initWithFrame:bounds];
+        [webview_ setDelegate:self];
+        [self addSubview:webview_];
 
-        [scroller_ setFixedBackgroundPattern:YES];
-        [scroller_ setBackgroundColor:[UIColor blackColor]];
-
-        [scroller_ setScrollingEnabled:YES];
-        [scroller_ setClipsSubviews:YES];
-
-        if (!Wildcat_)
-            [scroller_ setAllowsRubberBanding:YES];
-
-        [scroller_ setDelegate:self];
-        [scroller_ setBounces:YES];
-
-        if (!Wildcat_) {
-            [scroller_ setScrollHysteresis:8];
-            [scroller_ setThumbDetectionEnabled:NO];
-            [scroller_ setDirectionalScrolling:YES];
-            //[scroller_ setScrollDecelerationFactor:0.99]; /* 0.989324 */
-            [scroller_ setEventMode:YES];
-        }
-
-        if (Wildcat_) {
-            UIScrollView *scroller((UIScrollView *)scroller_);
-            //[scroller setDirectionalLockEnabled:NO];
-            [scroller setDelaysContentTouches:NO];
-            //[scroller setScrollsToTop:NO];
-            //[scroller setCanCancelContentTouches:NO];
-        }
-
-        [scroller_ setShowBackgroundShadow:NO]; /* YES */
-        //[scroller_ setAllowsRubberBanding:YES]; /* Vertical */
-
-        if (!Wildcat_)
-            [scroller_ setAdjustForContentSizeChange:YES]; /* NO */
-
-        CGRect rect([scroller_ bounds]);
-        //rect.size.height = 0;
-
-        WebThreadLock();
-
-        document_ = [[$UIWebBrowserView alloc] initWithFrame:rect];
-        WebView *webview([document_ webView]);
-
-        [document_ setBackgroundColor:[UIColor blackColor]];
-        if ([document_ respondsToSelector:@selector(setDrawsBackground:)])
-            [document_ setDrawsBackground:NO];
-        [webview setDrawsBackground:NO];
-
-        [webview setPreferencesIdentifier:@"WebCycript"];
-
-        [document_ setTileSize:CGSizeMake(rect.size.width, 500)];
-
-        if ([document_ respondsToSelector:@selector(enableReachability)])
-            [document_ enableReachability];
-        if ([document_ respondsToSelector:@selector(setAllowsMessaging:)])
-            [document_ setAllowsMessaging:YES];
-        if ([document_ respondsToSelector:@selector(useSelectionAssistantWithMode:)])
-            [document_ useSelectionAssistantWithMode:0];
-
-        [document_ setTilingEnabled:YES];
-        [document_ setDrawsGrid:NO];
-        [document_ setLogsTilingChanges:NO];
-        [document_ setTileMinificationFilter:kCAFilterNearest];
-
-        if ([document_ respondsToSelector:@selector(setDataDetectorTypes:)])
-            /* XXX: abstractify */
-            [document_ setDataDetectorTypes:0x80000000];
+        if ([webview_ respondsToSelector:@selector(setDataDetectorTypes:)])
+            [webview_ setDataDetectorTypes:0x80000000];
         else
-            [document_ setDetectsPhoneNumbers:NO];
-
-        [document_ setAutoresizes:YES];
+            [webview_ setDetectsPhoneNumbers:NO];
 
-        [document_ setMinimumScale:0.25f forDocumentTypes:0x10];
-        [document_ setMaximumScale:5.00f forDocumentTypes:0x10];
-        [document_ setInitialScale:UIWebViewScalesToFitScale forDocumentTypes:0x10];
-        //[document_ setViewportSize:CGSizeMake(980, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10];
+        [webview_ setScalesPageToFit:YES];
 
-        [document_ setViewportSize:CGSizeMake(320, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x2];
-
-        [document_ setMinimumScale:1.00f forDocumentTypes:0x8];
-        [document_ setInitialScale:UIWebViewScalesToFitScale forDocumentTypes:0x8];
-        [document_ setViewportSize:CGSizeMake(320, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x8];
-
-        [document_ _setDocumentType:0x4];
-
-        if ([document_ respondsToSelector:@selector(setZoomsFocusedFormControl:)])
-            [document_ setZoomsFocusedFormControl:YES];
-        [document_ setContentsPosition:7];
-        [document_ setEnabledGestures:0xa];
-        [document_ setValue:[NSNumber numberWithBool:YES] forGestureAttribute:UIGestureAttributeIsZoomRubberBandEnabled];
-        [document_ setValue:[NSNumber numberWithBool:YES] forGestureAttribute:UIGestureAttributeUpdatesScroller];
+        UIWebDocumentView *document([webview_ _documentView]);
+        WebView *webview([document webView]);
+        WebPreferences *preferences([webview preferences]);
 
-        [document_ setSmoothsFonts:YES];
-        [document_ setAllowsImageSheet:YES];
-        [webview _setUsesLoaderCache:YES];
+        [document setTileSize:CGSizeMake(bounds.size.width, 500)];
 
-        [webview setGroupName:@"CydgetGroup"];
+        [document setBackgroundColor:[UIColor blackColor]];
+        [document setDrawsBackground:NO];
 
-        WebPreferences *preferences([webview preferences]);
+        [webview setPreferencesIdentifier:@"WebCycript"];
 
         if ([webview respondsToSelector:@selector(_setLayoutInterval:)])
             [webview _setLayoutInterval:0];
         else
             [preferences _setLayoutInterval:0];
 
-        [self setViewportWidth:0];
+        [preferences setCacheModel:WebCacheModelDocumentViewer];
+        [preferences setJavaScriptCanOpenWindowsAutomatically:YES];
+        [preferences setOfflineWebApplicationCacheEnabled:YES];
 
-        [document_ setDelegate:self];
-        [document_ setGestureDelegate:self];
+        if ([webview respondsToSelector:@selector(setShouldUpdateWhileOffscreen:)])
+            [webview setShouldUpdateWhileOffscreen:NO];
 
-        if ([document_ respondsToSelector:@selector(setFormEditingDelegate:)])
-            [document_ setFormEditingDelegate:self];
-        [document_ setInteractionDelegate:self];
+        if ([document respondsToSelector:@selector(setAllowsMessaging:)])
+            [document setAllowsMessaging:YES];
+        if ([webview respondsToSelector:@selector(_setAllowsMessaging:)])
+            [webview _setAllowsMessaging:YES];
 
-        [scroller_ addSubview:document_];
+        if ([webview_ respondsToSelector:@selector(_scrollView)]) {
+            scroller_ = [webview_ _scrollView];
 
-        //NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+            [scroller_ setDirectionalLockEnabled:YES];
+            [scroller_ setDecelerationRate:CYScrollViewDecelerationRateNormal];
+            [scroller_ setDelaysContentTouches:NO];
 
-        indirect_ = [[WebCycriptDelegate alloc] initWithDelegate:self];
+            [scroller_ setCanCancelContentTouches:YES];
 
-        [webview setFrameLoadDelegate:indirect_];
-        [webview setPolicyDelegate:indirect_];
-        [webview setResourceLoadDelegate:indirect_];
-        [webview setUIDelegate:indirect_];
+            [scroller_ setAlwaysBounceVertical:NO];
+        } else if ([webview_ respondsToSelector:@selector(_scroller)]) {
+            UIScroller *scroller([webview_ _scroller]);
+            scroller_ = (UIScrollView *) scroller;
 
-        /* XXX: do not turn this on under penalty of extreme pain */
-        [webview setScriptDebugDelegate:nil];
+            [scroller setDirectionalScrolling:YES];
+            [scroller setScrollDecelerationFactor:CYScrollViewDecelerationRateNormal]; /* 0.989324 */
+            [scroller setScrollHysteresis:0]; /* 8 */
+
+            [scroller setThumbDetectionEnabled:NO];
+        }
 
-        WebThreadUnlock();
+        [scroller_ setFixedBackgroundPattern:YES];
+        [scroller_ setBackgroundColor:[UIColor blackColor]];
+        [scroller_ setClipsSubviews:NO];
 
-        CGSize indsize([UIProgressIndicator defaultSizeForStyle:UIProgressIndicatorStyleMediumWhite]);
-        indicator_ = [[UIProgressIndicator alloc] initWithFrame:CGRectMake(281, 12, indsize.width, indsize.height)];
-        [indicator_ setStyle:UIProgressIndicatorStyleMediumWhite];
+        [scroller_ setBounces:YES];
+        [scroller_ setShowBackgroundShadow:NO]; /* YES */
 
-        [self setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
-        [scroller_ setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
+        [self setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
+        [webview_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
 
         NSDictionary *configuration([$CydgetController currentConfiguration]);
 
         cycript_ = [configuration objectForKey:@"CycriptURLs"];
 
-        scrollable_ = [[configuration objectForKey:@"Scrollable"] boolValue];
-        [scroller_ setScrollingEnabled:scrollable_];
+        [scroller_ setScrollingEnabled:[[configuration objectForKey:@"Scrollable"] boolValue]];
 
         NSString *homepage([configuration objectForKey:@"Homepage"]);
         [self loadURL:[NSURL URLWithString:homepage]];
-
-        /*[UIKeyboard initImplementationNow];
-        CGSize keysize = [UIKeyboard defaultSize];
-        CGRect keyrect = {{0, [self bounds].size.height - 100}, keysize};
-        keyboard_ = [[UIKeyboard alloc] initWithFrame:keyrect];
-        [self addSubview:keyboard_];
-
-        [self addSubview:[[UITextView alloc] initWithFrame:CGRectMake(200, 0, 100, 100)]];
-        [self addSubview:[[UITextView alloc] initWithFrame:CGRectMake(200, 150, 100, 100)]];
-        [self addSubview:[[UITextView alloc] initWithFrame:CGRectMake(200, 300, 100, 100)]];*/
     } return self;
 }
 
-- (void) webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
-    [self retain];
-
-    UIActionSheet *sheet = [[[UIActionSheet alloc]
-        initWithTitle:nil
-        buttons:[NSArray arrayWithObjects:@"OK", nil]
-        defaultButtonIndex:0
-        delegate:self
-        context:@"alert"
-    ] autorelease];
-
-    [sheet setBodyText:message];
-    [sheet popupAlertAnimated:YES];
-}
-
-- (BOOL) webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
-    [self retain];
-
-    UIActionSheet *sheet = [[[UIActionSheet alloc]
-        initWithTitle:nil
-        buttons:[NSArray arrayWithObjects:@"OK", @"CANCEL", nil]
-        defaultButtonIndex:0
-        delegate:indirect_
-        context:@"confirm"
-    ] autorelease];
-
-    [sheet setNumberOfRows:1];
-    [sheet setBodyText:message];
-    [sheet popupAlertAnimated:YES];
-
-    NSRunLoop *loop([NSRunLoop currentRunLoop]);
-    NSDate *future([NSDate distantFuture]);
-
-    while (confirm_ == nil && [loop runMode:NSDefaultRunLoopMode beforeDate:future]);
-
-    NSNumber *confirm([confirm_ autorelease]);
-    confirm_ = nil;
-
-    [self autorelease];
-    return [confirm boolValue];
-}
-
-/* XXX: WebThreadLock? */
-- (void) _fixScroller:(CGRect)bounds {
-    float extra;
-    if (!editing_ || $UIFormAssistant == nil)
-        extra = 0;
-    else {
-        UIFormAssistant *assistant([$UIFormAssistant sharedFormAssistant]);
-        CGRect peripheral([assistant peripheralFrame]);
-        extra = peripheral.size.height;
-    }
-
-    CGRect subrect([scroller_ frame]);
-    subrect.size.height -= [TPBottomLockBar defaultHeight];
-    subrect.size.height -= extra;
-
-    if ([scroller_ respondsToSelector:@selector(setScrollerIndicatorSubrect:)])
-        [scroller_ setScrollerIndicatorSubrect:subrect];
-
-    [document_ setValue:[NSValue valueWithSize:NSMakeSize(subrect.size.width, subrect.size.height)] forGestureAttribute:UIGestureAttributeVisibleSize];
-
-    CGSize size(size_);
-    size.height += extra;
-    size.height += [TPBottomLockBar defaultHeight];
-    [scroller_ setContentSize:size];
-
-    if ([scroller_ respondsToSelector:@selector(releaseRubberBandIfNecessary)])
-        [scroller_ releaseRubberBandIfNecessary];
-}
-
-- (void) fixScroller {
-    CGRect bounds([document_ documentBounds]);
-    [self _fixScroller:bounds];
-}
-
-- (void) view:(UIView *)sender didSetFrame:(CGRect)frame {
-    size_ = frame.size;
-    [self _fixScroller:frame];
-}
-
-- (void) view:(UIView *)sender didSetFrame:(CGRect)frame oldFrame:(CGRect)old {
-    [self view:sender didSetFrame:frame];
-}
-
-- (void) formAssistant:(id)sender didBeginEditingFormNode:(id)node {
-}
-
-- (void) formAssistant:(id)sender didEndEditingFormNode:(id)node {
-    [self fixScroller];
-}
-
-- (void) webView:(WebView *)sender willBeginEditingFormElement:(id)element {
-    editing_ = true;
-}
-
-- (void) webView:(WebView *)sender didBeginEditingFormElement:(id)element {
-    [self fixScroller];
-}
-
-- (void) webViewDidEndEditingFormElements:(WebView *)sender {
-    editing_ = false;
-    [self fixScroller];
-}
-
-- (void) webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame {
+- (void) webView:(WebView *)webview didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame {
     if (cycript_ != nil)
         if (NSString *href = [[[[frame dataSource] request] URL] absoluteString])
             if (Pcre([cycript_ UTF8String], 0 /*XXX:PCRE_UTF8*/)(href))
                 if (void *handle = dlopen("/usr/lib/libcycript.dylib", RTLD_LAZY | RTLD_GLOBAL))
                     if (void (*CYSetupContext)(JSGlobalContextRef) = reinterpret_cast<void (*)(JSGlobalContextRef)>(dlsym(handle, "CydgetSetupContext"))) {
-                        WebView *webview([document_ webView]);
                         WebFrame *frame([webview mainFrame]);
                         JSGlobalContextRef context([frame globalContext]);
                         CYSetupContext(context);
                     }
 }
 
-- (bool) isLoading {
-    return [loading_ count] != 0;
-}
-
-- (void) reloadButtons {
-    if ([self isLoading]) {
-        [UIApp setNetworkActivityIndicatorVisible:YES];
-        [indicator_ startAnimation];
-    } else {
-        [UIApp setNetworkActivityIndicatorVisible:NO];
-        [indicator_ stopAnimation];
-    }
-}
-
-- (void) _finishLoading {
-    size_t count([loading_ count]);
-    /*if (count == 0)
-        [self autorelease];*/
-    if (reloading_ || count != 0)
-        return;
-    [self reloadButtons];
-}
-
-- (BOOL) webView:(WebView *)sender shouldScrollToPoint:(struct CGPoint)point forFrame:(WebFrame *)frame {
-    return [document_ webView:sender shouldScrollToPoint:point forFrame:frame];
-}
-
-- (void) webView:(WebView *)sender didReceiveViewportArguments:(id)arguments forFrame:(WebFrame *)frame {
-    return [document_ webView:sender didReceiveViewportArguments:arguments forFrame:frame];
-}
-
-- (void) webView:(WebView *)sender needsScrollNotifications:(id)notifications forFrame:(WebFrame *)frame {
-    return [document_ webView:sender needsScrollNotifications:notifications forFrame:frame];
-}
-
-- (void) webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame {
-    return [document_ webView:sender didCommitLoadForFrame:frame];
-}
-
-- (void) webView:(WebView *)sender didReceiveDocTypeForFrame:(WebFrame *)frame {
-    return [document_ webView:sender didReceiveDocTypeForFrame:frame];
-}
+@end
 
-- (void) webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
-    [loading_ removeObject:[NSValue valueWithNonretainedObject:frame]];
-    [self _finishLoading];
-    return [document_ webView:sender didFinishLoadForFrame:frame];
+@interface WebCycriptLockScreenController : SBAwayViewPluginController {
 }
 
-- (void) webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame {
-    /*if ([loading_ count] == 0)
-        [self retain];*/
-    [loading_ addObject:[NSValue valueWithNonretainedObject:frame]];
-
-    if ([frame parentFrame] == nil) {
-        [document_ resignFirstResponder];
-
-        reloading_ = false;
-
-        if (Wildcat_) {
-            CGRect webrect = [scroller_ bounds];
-            webrect.size.height = 1;
-            [document_ setFrame:webrect];
-        }
-
-        if ([scroller_ respondsToSelector:@selector(scrollPointVisibleAtTopLeft:)])
-            [scroller_ scrollPointVisibleAtTopLeft:CGPointZero];
-        else
-            [scroller_ scrollRectToVisible:CGRectZero animated:NO];
-
-        if ([scroller_ respondsToSelector:@selector(setZoomScale:duration:)])
-            [scroller_ setZoomScale:1 duration:0];
-        else if ([scroller_ respondsToSelector:@selector(_setZoomScale:duration:)])
-            [scroller_ _setZoomScale:1 duration:0];
-        /*else if ([scroller_ respondsToSelector:@selector(setZoomScale:animated:)])
-            [scroller_ setZoomScale:1 animated:NO];*/
-
-        if (!Wildcat_) {
-            CGRect webrect = [scroller_ bounds];
-            webrect.size.height = 1;
-            [document_ setFrame:webrect];
-        }
-    }
+@end
 
-    [self reloadButtons];
-}
+#include <string>
 
-- (void) _didFailWithError:(NSError *)error forFrame:(WebFrame *)frame {
-    /*if ([frame parentFrame] == nil)
-        [self autorelease];*/
+struct State {
+    unsigned state;
+};
 
-    [loading_ removeObject:[NSValue valueWithNonretainedObject:frame]];
-    [self _finishLoading];
+// String Helpers {{{
+static const UChar *(*_ZNK7WebCore6String10charactersEv)(const WebCore::String *);
+static const UChar *(*_ZN7WebCore6String29charactersWithNullTerminationEv)(const WebCore::String *);
+static unsigned (*_ZNK7WebCore6String6lengthEv)(const WebCore::String *);
 
-    if (reloading_)
-        return;
+static bool StringGet(const WebCore::String &string, const UChar *&data, size_t &length) {
+    bool terminated;
 
-    if ([frame parentFrame] == nil) {
-        [self loadURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@?%@",
-            [[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"error" ofType:@"html"]] absoluteString],
-            [[error localizedDescription] stringByAddingPercentEscapes]
-        ]]];
+    if (_ZNK7WebCore6String10charactersEv != NULL) {
+        data = (*_ZNK7WebCore6String10charactersEv)(&string);
+        terminated = false;
+    } else if (_ZN7WebCore6String29charactersWithNullTerminationEv != NULL) {
+        data = (*_ZN7WebCore6String29charactersWithNullTerminationEv)(&string);
+        terminated = true;
+    } else return false;
 
-        error_ = true;
-    }
-}
+    if (_ZNK7WebCore6String6lengthEv != NULL)
+        length = (*_ZNK7WebCore6String6lengthEv)(&string);
+    else if (terminated)
+        for (length = 0; data[length] != 0; ++length);
+    else return false;
 
-- (void) webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame {
-    [self _didFailWithError:error forFrame:frame];
-    if ([document_ respondsToSelector:@selector(webView:didFailLoadWithError:forFrame:)])
-        [document_ webView:sender didFailLoadWithError:error forFrame:frame];
+    return true;
 }
 
-- (void) webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame {
-    [self _didFailWithError:error forFrame:frame];
-}
+static bool StringEquals(const WebCore::String &string, const char *value) {
+    const UChar *data;
+    size_t size;
+    if (!StringGet(string, data, size))
+        return false;
 
-- (void) webView:(WebView *)sender addMessageToConsole:(NSDictionary *)dictionary {
-    NSLog(@"Console:%@\n", [dictionary description]);
-}
+    size_t length(strlen(value));
+    if (size != length)
+        return false;
 
-@end
+    for (size_t index(0); index != length; ++index)
+        if (data[index] != value[index])
+            return false;
 
-@interface WebCycriptLockScreenController : SBAwayViewPluginController {
+    return true;
 }
-
-@end
-
-#include <string>
-
-struct State {
-    unsigned state;
-};
-
+// }}}
 // State Machine {{{
 static bool cycript_;
 
 MSHook(bool, _ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE, const WebCore::String &mime) {
-    _trace();
-    if (mime != "text/cycript") {
+    if (!StringEquals(mime, "text/cycript")) {
         cycript_ = false;
         return __ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE(mime);
     }
-    _trace();
 
     static void *handle(dlopen("/usr/lib/libcycript.dylib", RTLD_LAZY | RTLD_GLOBAL));
     if (handle == NULL)
@@ -956,20 +450,25 @@ MSHook(bool, _ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6
 // }}}
 // Script Compiler {{{
 static void Log(const WebCore::String &string) {
-    size_t length(string.length());
-    UChar data[length + 1];
-    data[length] = 0;
-    memcpy(data, string.characters(), length * 2);
-    NSLog(@"wtf %p:%S:", &string, data);
+#if 0
+    const UChar *data;
+    size_t length;
+    if (!StringGet(string, data, length))
+        return;
+
+    UChar terminated[length + 1];
+    terminated[length] = 0;
+    memcpy(terminated, data, length * 2);
+    NSLog(@"wtf %p:%zu:%S:", &string, length, terminated);
+#endif
 }
 
 static void Cycriptify(apr_pool_t *pool, const uint16_t *&data, size_t &size) {
     cycript_ = false;
 
-    _trace();
     if (void *handle = dlopen("/usr/lib/libcycript.dylib", RTLD_LAZY | RTLD_GLOBAL))
-        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")))
-            CYParseUChar(pool, &data, &size);
+        if (void (*CydgetPoolParse)(apr_pool_t *, const uint16_t **, size_t *) = reinterpret_cast<void (*)(apr_pool_t *, const uint16_t **, size_t *)>(dlsym(handle, "CydgetPoolParse")))
+            CydgetPoolParse(pool, &data, &size);
 }
 
 static void (*_ZN7WebCore6String6appendEPKtj)(WebCore::String *, const UChar *, unsigned);
@@ -979,8 +478,14 @@ static void Cycriptify(const WebCore::String &source, int *psize = NULL) {
     if (!cycript_)
         return;
 
-    const uint16_t *data(source.characters());
-    size_t length(source.length()), size(length);
+    const UChar *data;
+    size_t length;
+
+    if (!StringGet(source, data, length)) {
+        return;
+    }
+
+    size_t size(length);
 
     apr_pool_t *pool;
     apr_pool_create(&pool, NULL);
@@ -1025,16 +530,8 @@ bool CYWeakHell() {
 
 static WebCore::String *string;
 
-MSHook(const WebCore::String &, _ZNK7WebCore20StringSourceProvider6sourceEv, void *_this) {
-    _trace();
-    const WebCore::String &source(__ZNK7WebCore20StringSourceProvider6sourceEv(_this));
-    string = const_cast<WebCore::String *>(&source);
-    return source;
-}
-
 // iOS 2.x
 MSHook(State, _ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_6StringENS0_5StateES3_i, void *_this, const WebCore::String &string, State state, const WebCore::String &url, int line) {
-    _trace();
     Cycriptify(string);
     return __ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_6StringENS0_5StateES3_i(_this, string, state, url, line);
 }
@@ -1042,7 +539,7 @@ MSHook(State, _ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_6StringENS0_5Stat
 // iOS 3.x
 MSHook(void, _ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE, JSC::SourceCode **_this, JSC::JSGlobalData *global, int *line, JSC::UString *message) {
     if (cycript_) {
-        JSC::SourceCode *source(*_this);
+        JSC::SourceCode *source(_this[iOS32 ? 6 : 0]);
         const uint16_t *data(source->data());
         size_t size(source->length());
 
@@ -1063,14 +560,12 @@ MSHook(void, _ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE, JSC::Sourc
 
 // iOS 4.x cdata
 MSHook(void, _ZN7WebCore16ScriptSourceCodeC2ERKNS_6StringERKNS_4KURLEi, void *_this, const WebCore::String &source, const WebCore::KURL &url, int line) {
-    _trace();
     Cycriptify(source);
     return __ZN7WebCore16ScriptSourceCodeC2ERKNS_6StringERKNS_4KURLEi(_this, source, url, line);
 }
 
 // iOS 4.x @src=
 MSHook(const WebCore::String &, _ZN7WebCore12CachedScript6scriptEv, void *_this) {
-    _trace();
     const WebCore::String &script(__ZN7WebCore12CachedScript6scriptEv(_this));
     string = const_cast<WebCore::String *>(&script);
     Log(script);
@@ -1079,7 +574,6 @@ MSHook(const WebCore::String &, _ZN7WebCore12CachedScript6scriptEv, void *_this)
 
 // iOS 4.x @src=
 MSHook(State, _ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_16ScriptSourceCodeENS0_5StateE, void *_this, void *source, State state) {
-    _trace();
     if (string != NULL) {
         if (iOS4)
             Cycriptify(*string, reinterpret_cast<int *>(source) + 3);
@@ -1335,19 +829,42 @@ static void dlset(Type_ &function, const char *name) {
     function = reinterpret_cast<Type_>(dlsym(RTLD_DEFAULT, name));
 }
 
+template <typename Type_>
+static void msset_(Type_ &function, const char *name, MSImageRef handle) {
+    function = reinterpret_cast<Type_>(MSFindSymbol(handle, name));
+}
+
+#define msset(function, handle) \
+    msset_(function, "_" #function, handle)
+
 @implementation WebCycriptLockScreenController
 
-+ (void) initialize {
-    iOS4 = kCFCoreFoundationVersionNumber >= 550.32;
+static void $UIWebViewWebViewDelegate$webView$addMessageToConsole$(UIWebViewWebViewDelegate *self, SEL sel, WebView *view, NSDictionary *message) {
+    UIWebView *uiWebView(MSHookIvar<UIWebView *>(self, "uiWebView"));
+    if ([uiWebView respondsToSelector:@selector(webView:addMessageToConsole:)])
+        [uiWebView webView:view addMessageToConsole:message];
+}
 
-    $UIWebBrowserView = objc_getClass("UIWebBrowserView");
-    if ($UIWebBrowserView == nil) {
-        Wildcat_ = false;
-        $UIWebBrowserView = objc_getClass("UIWebDocumentView");
-    } else {
-        Wildcat_ = true;
+static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIWebViewWebViewDelegate *self, SEL sel, WebView *view, WebScriptObject *window, WebFrame *frame) {
+    UIWebView *uiWebView(MSHookIvar<UIWebView *>(self, "uiWebView"));
+    if ([uiWebView respondsToSelector:@selector(webView:didClearWindowObject:forFrame:)])
+        [uiWebView webView:view didClearWindowObject:window forFrame:frame];
+}
+
++ (void) initialize {
+    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<float *>(dlsym(RTLD_DEFAULT, "UIScrollViewDecelerationRateNormal")))
+        CYScrollViewDecelerationRateNormal = *_UIScrollViewDecelerationRateNormal;
+    else // XXX: this actually might be fast on some older systems: we should look into this
+        CYScrollViewDecelerationRateNormal = 0.998;
+
+    iOS4 = kCFCoreFoundationVersionNumber >= 550.32;
+    iOS32 = !iOS4 && kCFCoreFoundationVersionNumber >= 478.61;
+
     int maxproc;
     size_t size(sizeof(maxproc));
     if (sysctlbyname("kern.maxproc", &maxproc, &size, NULL, 0) == -1)
@@ -1405,10 +922,6 @@ static void dlset(Type_ &function, const char *name) {
             MSHookFunction(_ZN7WebCore12CachedScript6scriptEv, MSHake(_ZN7WebCore12CachedScript6scriptEv));
     }
 
-    /*const WebCore::String &(*_ZNK7WebCore20StringSourceProvider6sourceEv)(void *);
-    nlset(_ZNK7WebCore20StringSourceProvider6sourceEv, nl, 3);
-    MSHookFunction(_ZNK7WebCore20StringSourceProvider6sourceEv, MSHake(_ZNK7WebCore20StringSourceProvider6sourceEv));*/
-
     State (*_ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_6StringENS0_5StateES3_i)(void *, const WebCore::String &, State, const WebCore::String &, int);
     nlset(_ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_6StringENS0_5StateES3_i, nl, 4);
     if (_ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_6StringENS0_5StateES3_i != NULL)
@@ -1423,6 +936,19 @@ static void dlset(Type_ &function, const char *name) {
 
     nlset(_ZN7WebCore6String6appendEPKtj, nl, 6);
     nlset(_ZN7WebCore6String8truncateEj, nl, 7);
+
+    MSImageRef JavaScriptCore(MSGetImageByName("/System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore"));
+    MSImageRef WebCore(MSGetImageByName("/System/Library/PrivateFrameworks/WebCore.framework/WebCore"));
+
+    if (_ZN7WebCore6String6appendEPKtj == NULL)
+        msset(_ZN7WebCore6String6appendEPKtj, JavaScriptCore);
+
+    if (_ZN7WebCore6String8truncateEj == NULL)
+        msset(_ZN7WebCore6String8truncateEj, JavaScriptCore);
+
+    msset(_ZNK7WebCore6String10charactersEv, WebCore);
+    msset(_ZN7WebCore6String29charactersWithNullTerminationEv, JavaScriptCore);
+    msset(_ZNK7WebCore6String6lengthEv, WebCore);
 }
 
 + (id) rootViewController {
@@ -1434,3 +960,10 @@ static void dlset(Type_ &function, const char *name) {
 }
 
 @end
+
+MSClassHook(WebView)
+MSMetaClassHook(WebView)
+
+MSClassMessageHook0(void, WebView, enableWebThread) {
+    NSLog(@"-[WebView enableWebThread]");
+}