]> git.saurik.com Git - cydget.git/commitdiff
This was a bad idea: I'm not going to do this again.
authorJay Freeman (saurik) <saurik@saurik.com>
Fri, 6 Nov 2009 11:12:24 +0000 (11:12 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Fri, 6 Nov 2009 11:12:24 +0000 (11:12 +0000)
LockScreen.mm
control
makefile

index 9ac2c022547d0a3f6c2d66de030ae60c9b5821eb..368d13dc57549a8c6e1e120aca73a6408928781e 100644 (file)
@@ -37,6 +37,8 @@
 
 #include <substrate.h>
 
+#define WTF_USE_JSC 1
+
 #import <GraphicsServices/GraphicsServices.h>
 #import <UIKit/UIKit.h>
 #import <AddressBook/AddressBook.h>
@@ -69,6 +71,11 @@ extern NSString * const kCAFilterNearest;
 #include <WebCore/WebCoreThread.h>
 #include <WebKit/WebPreferences-WebPrivate.h>
 
+#include "wtf/Platform.h"
+#include "CString.h"
+#include "ScriptElement.h"
+#include "ScriptSourceCode.h"
+
 @interface WebView (UICaboodle)
 - (void) setScriptDebugDelegate:(id)delegate;
 - (void) _setFormDelegate:(id)delegate;
@@ -82,6 +89,14 @@ extern NSString * const kCAFilterNearest;
 
 _disused static unsigned trace_;
 
+#define _assert(test) do { \
+    if (!(test)) { \
+        NSLog(@"_assert(%u)@%s:%u[%s]\n", \
+            trace_++, __FILE__, __LINE__, __FUNCTION__\
+        ); \
+    } \
+} while (false)
+
 #define _trace() do { \
     NSLog(@"_trace(%u)@%s:%u[%s]\n", \
         trace_++, __FILE__, __LINE__, __FUNCTION__\
@@ -539,6 +554,7 @@ _trace();
     subrect.size.height -= extra;
     [scroller_ setScrollerIndicatorSubrect:subrect];
 
+#undef NSSize
     NSSize visible(NSMakeSize(subrect.size.width, subrect.size.height));
     [document_ setValue:[NSValue valueWithSize:visible] forGestureAttribute:UIGestureAttributeVisibleSize];
 
@@ -693,8 +709,56 @@ _trace();
 
 @end
 
+WebCore::String (*__ZNK7WebCore6String15stripWhiteSpaceEv)(WebCore::String *);
+extern "C" WebCore::String _ZNK7WebCore6String15stripWhiteSpaceEv(WebCore::String *_this) {
+    return __ZNK7WebCore6String15stripWhiteSpaceEv(_this); }
+WebCore::String (*__ZNK7WebCore6String5lowerEv)(WebCore::String *);
+extern "C" WebCore::String _ZNK7WebCore6String5lowerEv(WebCore::String *_this) {
+    return __ZNK7WebCore6String5lowerEv(_this); }
+WebCore::CString (*__ZNK7WebCore6String4utf8Ev)(WebCore::String *);
+extern "C" WebCore::CString _ZNK7WebCore6String4utf8Ev(WebCore::String *_this) {
+    return __ZNK7WebCore6String4utf8Ev(_this); }
+const char *(*__ZNK7WebCore7CString4dataEv)(WebCore::CString *);
+extern "C" const char *_ZNK7WebCore7CString4dataEv(WebCore::CString *_this) {
+    return __ZNK7WebCore7CString4dataEv(_this); }
+
+MSHook(void, _ZN7WebCore17ScriptElementData14evaluateScriptERKNS_16ScriptSourceCodeE, WebCore::ScriptElementData *_this, const WebCore::ScriptSourceCode &code) {
+    WebCore::String type(_this->m_scriptElement->typeAttributeValue());
+    type = type.stripWhiteSpace().lower();
+    NSLog(@"type:%s", type.utf8().data());
+    __ZN7WebCore17ScriptElementData14evaluateScriptERKNS_16ScriptSourceCodeE(_this, code);
+}
+
+template <typename Type_>
+static void nlset(Type_ &function, struct nlist *nl, size_t index) {
+    struct nlist &name(nl[index]);
+    uintptr_t value(name.n_value);
+    _assert(value != 0);
+    if ((name.n_desc & N_ARM_THUMB_DEF) != 0)
+        value |= 0x00000001;
+    function = reinterpret_cast<Type_>(value);
+}
+
 @implementation WebCycriptLockScreenController
 
++ (void) initialize {
+    struct nlist nl[6];
+    memset(nl, 0, sizeof(nl));
+    nl[0].n_un.n_name = (char *) "__ZN7WebCore17ScriptElementData14evaluateScriptERKNS_16ScriptSourceCodeE";
+    nl[1].n_un.n_name = (char *) "__ZNK7WebCore6String15stripWhiteSpaceEv";
+    nl[2].n_un.n_name = (char *) "__ZNK7WebCore6String5lowerEv";
+    nl[3].n_un.n_name = (char *) "__ZNK7WebCore6String4utf8Ev";
+    nl[4].n_un.n_name = (char *) "__ZNK7WebCore7CString4dataEv";
+    nlist("/System/Library/PrivateFrameworks/WebCore.framework/WebCore", nl);
+    void (*_ZN7WebCore17ScriptElementData14evaluateScriptERKNS_16ScriptSourceCodeE)(WebCore::ScriptElementData *, const WebCore::ScriptSourceCode &);
+    nlset(_ZN7WebCore17ScriptElementData14evaluateScriptERKNS_16ScriptSourceCodeE, nl, 0);
+    nlset(__ZNK7WebCore6String15stripWhiteSpaceEv, nl, 1);
+    nlset(__ZNK7WebCore6String5lowerEv, nl, 2);
+    nlset(__ZNK7WebCore6String4utf8Ev, nl, 3);
+    nlset(__ZNK7WebCore7CString4dataEv, nl, 4);
+    MSHookFunction(_ZN7WebCore17ScriptElementData14evaluateScriptERKNS_16ScriptSourceCodeE, MSHake(_ZN7WebCore17ScriptElementData14evaluateScriptERKNS_16ScriptSourceCodeE));
+}
+
 + (id) rootViewController {
     return [[[self alloc] init] autorelease];
 }
diff --git a/control b/control
index bc5a6f25a59d36b6ea8b7642e6fe4dbd17ee8333..a8b276bd4992f02bcad2e33560d8d600f733dca2 100644 (file)
--- a/control
+++ b/control
@@ -3,7 +3,7 @@ Priority: optional
 Section: Development
 Maintainer: Jay Freeman (saurik) <saurik@saurik.com>
 Architecture: iphoneos-arm
-Version: 0.9.3066-1
+Version: 0.9.3076-1
 Description: framework for managing lock screen plugins
 Name: Cydget
 Depends: mobilesubstrate (>= 0.9.2587-1)
index 637b624b99c7199da8a81ab75158714c96831474..5c0564e6e3802205f29990bf5f221600fe30203a 100644 (file)
--- a/makefile
+++ b/makefile
@@ -2,11 +2,13 @@ name := CydgetLoader
 flags := -framework UIKit -framework AddressBook
 base := $(shell cd ~; pwd)/menes/tweaks
 include $(base)/tweak.mk
+webcore := WebCore-514
+jscore := JavaScriptCore-521
 
 all: WebCycriptLockScreen
 
 WebCycriptLockScreen: LockScreen.mm makefile $(base)/../mobilesubstrate/substrate.h
-       $(target)g++ -bundle -mthumb -g0 -O2 -Wall -Werror -o $@ $(filter %.mm,$^) -lobjc -I$(base)/../mobilesubstrate $(link) $(flags) -framework CoreGraphics -framework QuartzCore -framework SpringBoardUI -framework WebCore -framework GraphicsServices -framework TelephonyUI
+       $(target)g++ -bundle -mthumb -g0 -O2 -Wall -Werror -o $@ $(filter %.mm,$^) -lobjc -I$(base)/../mobilesubstrate $(link) $(flags) -framework CoreGraphics -framework QuartzCore -framework SpringBoardUI -framework WebCore -framework JavaScriptCore -framework GraphicsServices -framework TelephonyUI -I$(jscore) -iquote$(webcore)/{bindings/js,dom,loader,platform{,/animation,/cf,/network{,/cf},/text},/rendering/style} -iquote$(jscore)/{jit,runtime}
        ldid -S $@
 
 extra: