#include <WebKit/WebPreferences-WebPrivate.h>
#include "JSGlobalData.h"
+
#include "SourceCode.h"
+#include "SourceCode4.h"
#include <apr-1/apr_pools.h>
#include <pcre.h>
static Class $SBStatusBarController(objc_getClass("SBStatusBarController"));
static Class $UIWebBrowserView;
-static bool Wildcat_;
+static bool Wildcat_, iOS4;
@interface NSString (UIKit)
- (NSString *) stringByAddingPercentEscapes;
@implementation UIWebDocumentView (WebCycript)
-- (void) _initialize {
- $UIWebBrowserView = objc_getClass("UIWebBrowserView");
- if ($UIWebBrowserView == nil) {
- Wildcat_ = false;
- $UIWebBrowserView = objc_getClass("UIWebDocumentView");
- } else {
- Wildcat_ = true;
- }
-}
-
- (void) _setScrollerOffset:(CGPoint)offset {
UIScroller *scroller([self _scroller]);
WebThreadLock();
- document_ = [[UIWebDocumentView alloc] initWithFrame:rect];
+ document_ = [[$UIWebBrowserView alloc] initWithFrame:rect];
WebView *webview([document_ webView]);
[document_ setBackgroundColor:[UIColor blackColor]];
false;
}
-MSHook(void, _ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE, JSC::SourceCode **_this, JSC::JSGlobalData *global, int *line, JSC::UString *message) {
+MSHook(void, _ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE, void **_this, JSC::JSGlobalData *global, int *line, JSC::UString *message) {
if (!GetParser0())
return __ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE(_this, global, line, message);
else {
SetParser(false, true);
- JSC::SourceCode *source(*_this);
- const uint16_t *data(source->data());
- size_t size(source->length());
+ const uint16_t *data;
+ size_t size;
+
+ JSC::SourceCode *source(reinterpret_cast<JSC::SourceCode *>(_this[0]));
+ JSC::SourceCode4 *source4(reinterpret_cast<JSC::SourceCode4 *>(_this[13]));
+
+ if (iOS4) {
+ data = source4->data();
+ size = source4->length();
+ } else {
+ data = source->data();
+ size = source->length();
+ }
apr_pool_t *pool;
apr_pool_create(&pool, NULL);
+ //NSLog(@"!:%u:%@", size, [[[NSString alloc] initWithBytes:const_cast<char *>(reinterpret_cast<const char *>(data)) length:size encoding:NSUnicodeStringEncoding] autorelease]);
Cycriptify(pool, data, size);
- source->~SourceCode();
- new (source) JSC::SourceCode(JSC::UStringSourceProvider::create(JSC::UString(data, size), "cycript://"), 1);
+ //NSLog(@"%:%u:%@", size, [[[NSString alloc] initWithBytes:const_cast<char *>(reinterpret_cast<const char *>(data)) length:size encoding:NSUnicodeStringEncoding] autorelease]);
+
+ if (iOS4) {
+ NSLog(@":*");
+ source4->~SourceCode4();
+ NSLog(@":@");
+ new (source4) JSC::SourceCode4(JSC::UStringSourceProvider::create(JSC::UString(data, size), "cycript://"), 1);
+ NSLog(@":#");
+ } else {
+ source->~SourceCode();
+ new (source) JSC::SourceCode(JSC::UStringSourceProvider::create(JSC::UString(data, size), "cycript://"), 1);
+ }
apr_pool_destroy(pool);
@implementation WebCycriptLockScreenController
+ (void) initialize {
+ iOS4 = kCFCoreFoundationVersionNumber >= 550.32;
+
+ $UIWebBrowserView = objc_getClass("UIWebBrowserView");
+ if ($UIWebBrowserView == nil) {
+ Wildcat_ = false;
+ $UIWebBrowserView = objc_getClass("UIWebDocumentView");
+ } else {
+ Wildcat_ = true;
+ }
+
int maxproc;
size_t size(sizeof(maxproc));
if (sysctlbyname("kern.maxproc", &maxproc, &size, NULL, 0) == -1)
[NSURLProtocol registerClass:[CydgetURLProtocol class]];
[NSURLProtocol registerClass:[CydgetCGIURLProtocol class]];
- void (*_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE)(JSC::SourceCode **, JSC::JSGlobalData *, int *, JSC::UString *);
+ void (*_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE)(void **, JSC::JSGlobalData *, int *, JSC::UString *);
dlset(_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE, "_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE");
if (_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE != NULL)
MSHookFunction(_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE, MSHake(_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE));