]> git.saurik.com Git - cydget.git/commitdiff
Port WebCycript parser (CDATA only) to iOS 5.0.
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 29 Feb 2012 02:35:54 +0000 (02:35 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Wed, 29 Feb 2012 02:39:59 +0000 (02:39 +0000)
LockScreen.mm

index 9c1c4b5862f1fc209b8c0fff25f4900eb6d23008..a4b0e98cee01957d26fbc92fff9b43b7983c9d89 100644 (file)
@@ -595,6 +595,12 @@ MSHook(State, _ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_16ScriptSourceCod
     return __ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_16ScriptSourceCodeENS0_5StateE(_this, source, state);
 }
 
+// iOS 5.0 cdata
+MSHook(void, _ZN7WebCore16ScriptSourceCodeC2ERKN3WTF6StringERKNS_4KURLERKNS1_12TextPositionINS1_14OneBasedNumberEEE, void *_this, const WebCore::String &source, const WebCore::KURL &url, void *position) {
+    Cycriptify(source);
+    return __ZN7WebCore16ScriptSourceCodeC2ERKN3WTF6StringERKNS_4KURLERKNS1_12TextPositionINS1_14OneBasedNumberEEE(_this, source, url, position);
+}
+
 /* Cydget:// Protocol {{{ */
 @interface CydgetURLProtocol : NSURLProtocol {
 }
@@ -894,6 +900,9 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW
     [NSURLProtocol registerClass:[CydgetCGIURLProtocol class]];
     [WebView registerURLSchemeAsLocal:@"cydget-cgi"];
 
+    MSImageRef JavaScriptCore(MSGetImageByName("/System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore"));
+    MSImageRef WebCore(MSGetImageByName("/System/Library/PrivateFrameworks/WebCore.framework/WebCore"));
+
     if (!iOS4) {
         void (*_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE)(JSC::SourceCode **, JSC::JSGlobalData *, int *, JSC::UString *);
         dlset(_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE, "_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE");
@@ -921,6 +930,8 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW
 
     bool (*_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE)(const WebCore::String &);
     nlset(_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE, nl, 0);
+    if (_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE == NULL)
+        MSHookSymbol(_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE, "__ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKN3WTF6StringE", WebCore);
     if (_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE != NULL)
         MSHookFunction(_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE, MSHake(_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE));
 
@@ -951,17 +962,27 @@ static void $UIWebViewWebViewDelegate$webView$didClearWindowObject$forFrame$(UIW
     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"));
+    void (*_ZN7WebCore16ScriptSourceCodeC2ERKN3WTF6StringERKNS_4KURLERKNS1_12TextPositionINS1_14OneBasedNumberEEE)(void *, const WebCore::String &, const WebCore::KURL &, void *);
+    msset(_ZN7WebCore16ScriptSourceCodeC2ERKN3WTF6StringERKNS_4KURLERKNS1_12TextPositionINS1_14OneBasedNumberEEE, WebCore);
+    if (_ZN7WebCore16ScriptSourceCodeC2ERKN3WTF6StringERKNS_4KURLERKNS1_12TextPositionINS1_14OneBasedNumberEEE != NULL)
+        MSHookFunction(_ZN7WebCore16ScriptSourceCodeC2ERKN3WTF6StringERKNS_4KURLERKNS1_12TextPositionINS1_14OneBasedNumberEEE, MSHake(_ZN7WebCore16ScriptSourceCodeC2ERKN3WTF6StringERKNS_4KURLERKNS1_12TextPositionINS1_14OneBasedNumberEEE));
 
     if (_ZN7WebCore6String6appendEPKtj == NULL)
         msset(_ZN7WebCore6String6appendEPKtj, JavaScriptCore);
+    if (_ZN7WebCore6String6appendEPKtj == NULL)
+        MSHookSymbol(_ZN7WebCore6String6appendEPKtj, "__ZN3WTF6String6appendEPKtj", JavaScriptCore);
 
     if (_ZN7WebCore6String8truncateEj == NULL)
         msset(_ZN7WebCore6String8truncateEj, JavaScriptCore);
+    if (_ZN7WebCore6String8truncateEj == NULL)
+        MSHookSymbol(_ZN7WebCore6String8truncateEj, "__ZN3WTF6String8truncateEj", JavaScriptCore);
 
     msset(_ZNK7WebCore6String10charactersEv, WebCore);
+
     msset(_ZN7WebCore6String29charactersWithNullTerminationEv, JavaScriptCore);
+    if (_ZN7WebCore6String29charactersWithNullTerminationEv == NULL)
+        MSHookSymbol(_ZN7WebCore6String29charactersWithNullTerminationEv, "__ZN3WTF6String29charactersWithNullTerminationEv", JavaScriptCore);
+
     msset(_ZNK7WebCore6String6lengthEv, WebCore);
 }