MSHook(bool, _ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE, const WebCore::String &mime) {
_trace();
- if (mime != "text/cycript")
+ if (mime != "text/cycript") {
+ cycript_ = false;
return __ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE(mime);
+ }
_trace();
static void *handle(dlopen("/usr/lib/libcycript.dylib", RTLD_LAZY | RTLD_GLOBAL));
}
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")))
static void Cycriptify(const WebCore::String &source, int *psize = NULL) {
if (!cycript_)
return;
- cycript_ = false;
const uint16_t *data(source.characters());
size_t length(source.length()), size(length);
return __ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_6StringENS0_5StateES3_i(_this, string, state, url, line);
}
+// 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);
+ const uint16_t *data(source->data());
+ size_t size(source->length());
+
+ apr_pool_t *pool;
+ apr_pool_create(&pool, NULL);
+
+ Cycriptify(pool, data, size);
+ source->~SourceCode();
+ // XXX: I actually don't have the original URL here: pants
+ new (source) JSC::SourceCode(JSC::UStringSourceProvider::create(JSC::UString(data, size), "cycript://"), 1);
+
+ apr_pool_destroy(pool);
+
+ }
+
+ return __ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE(_this, global, line, message);
+}
+
// iOS 4.x cdata
MSHook(void, _ZN7WebCore16ScriptSourceCodeC2ERKNS_6StringERKNS_4KURLEi, void *_this, const WebCore::String &source, const WebCore::KURL &url, int line) {
_trace();
[NSURLProtocol registerClass:[CydgetURLProtocol class]];
[NSURLProtocol registerClass:[CydgetCGIURLProtocol class]];
+ if (!iOS4) {
+ void (*_ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE)(JSC::SourceCode **, 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));
+ }
+
struct nlist nl[9];
memset(nl, 0, sizeof(nl));
bool (*_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE)(const WebCore::String &);
nlset(_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE, nl, 0);
- MSHookFunction(_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE, MSHake(_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE));
+ if (_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE != NULL)
+ MSHookFunction(_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE, MSHake(_ZN7WebCore16MIMETypeRegistry29isSupportedJavaScriptMIMETypeERKNS_6StringE));
void (*_ZN7WebCore16ScriptSourceCodeC2ERKNS_6StringERKNS_4KURLEi)(void *, const WebCore::String &, const WebCore::KURL &, int);
nlset(_ZN7WebCore16ScriptSourceCodeC2ERKNS_6StringERKNS_4KURLEi, nl, 1);
- MSHookFunction(_ZN7WebCore16ScriptSourceCodeC2ERKNS_6StringERKNS_4KURLEi, MSHake(_ZN7WebCore16ScriptSourceCodeC2ERKNS_6StringERKNS_4KURLEi));
-
- const WebCore::String &(*_ZN7WebCore12CachedScript6scriptEv)(void *);
- nlset(_ZN7WebCore12CachedScript6scriptEv, nl, 2);
- MSHookFunction(_ZN7WebCore12CachedScript6scriptEv, MSHake(_ZN7WebCore12CachedScript6scriptEv));
+ if (_ZN7WebCore16ScriptSourceCodeC2ERKNS_6StringERKNS_4KURLEi != NULL)
+ MSHookFunction(_ZN7WebCore16ScriptSourceCodeC2ERKNS_6StringERKNS_4KURLEi, MSHake(_ZN7WebCore16ScriptSourceCodeC2ERKNS_6StringERKNS_4KURLEi));
+
+ if (iOS4) {
+ const WebCore::String &(*_ZN7WebCore12CachedScript6scriptEv)(void *);
+ nlset(_ZN7WebCore12CachedScript6scriptEv, nl, 2);
+ if (_ZN7WebCore12CachedScript6scriptEv != NULL)
+ MSHookFunction(_ZN7WebCore12CachedScript6scriptEv, MSHake(_ZN7WebCore12CachedScript6scriptEv));
+ }
/*const WebCore::String &(*_ZNK7WebCore20StringSourceProvider6sourceEv)(void *);
nlset(_ZNK7WebCore20StringSourceProvider6sourceEv, nl, 3);
if (_ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_6StringENS0_5StateES3_i != NULL)
MSHookFunction(_ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_6StringENS0_5StateES3_i, MSHake(_ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_6StringENS0_5StateES3_i));
- State (*_ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_16ScriptSourceCodeENS0_5StateE)(void *, void *, State);
- nlset(_ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_16ScriptSourceCodeENS0_5StateE, nl, 5);
- if (_ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_16ScriptSourceCodeENS0_5StateE != NULL)
- MSHookFunction(_ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_16ScriptSourceCodeENS0_5StateE, MSHake(_ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_16ScriptSourceCodeENS0_5StateE));
+ if (iOS4) {
+ State (*_ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_16ScriptSourceCodeENS0_5StateE)(void *, void *, State);
+ nlset(_ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_16ScriptSourceCodeENS0_5StateE, nl, 5);
+ if (_ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_16ScriptSourceCodeENS0_5StateE != NULL)
+ MSHookFunction(_ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_16ScriptSourceCodeENS0_5StateE, MSHake(_ZN7WebCore13HTMLTokenizer15scriptExecutionERKNS_16ScriptSourceCodeENS0_5StateE));
+ }
nlset(_ZN7WebCore6String6appendEPKtj, nl, 6);
nlset(_ZN7WebCore6String8truncateEj, nl, 7);
vertical-align:middle;
}
</style></head><body>
- <div id="content"><script type="text/cycript">
- document.write('<div id="lcd">');
-
- var locale = CFLocaleCopyCurrent();
- var now = CFDateCreate(NULL, CFAbsoluteTimeGetCurrent());
- var formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterNoStyle, kCFDateFormatterNoStyle);
- CFRelease(locale);
-
- CFDateFormatterSetFormat(formatter, UIDateFormatStringForFormatType(UINoAMPMTimeFormat));
- var time = CFDateFormatterCreateStringWithDate(NULL, formatter, now);
- document.write('<h1>');
- document.write(time);
- document.write('</h1>');
- CFRelease(time);
-
- CFDateFormatterSetFormat(formatter, UIDateFormatStringForFormatType(UIWeekdayNoYearDateFormat));
- var date = CFDateFormatterCreateStringWithDate(NULL, formatter, now);
- document.write('<h2>');
- document.write(date);
- document.write('</h2>');
- CFRelease(date);
-
- CFRelease(formatter);
- CFRelease(now);
-
- document.write('</div>');
-
+ <div id="content">
+ <script type="text/cycript" src="lcd.cy"></script>
+ <script type="text/cycript">
+ document.write([NSString stringWithString:'A'].toString());
+ </script>
+ <script type="text/cycript">
+ document.write([NSString stringWithString:'B'].toString());
+ </script>
+ <script type="text/cycript">
+ document.write([NSString stringWithString:'C'].toString());
+ </script>
+ <script type="text/cycript" src="lcd.cy"></script>
+ P
+ <script type="text/cycript">
+ document.write([NSString stringWithString:'D'].toString());
+ </script>
+ <script type="text/cycript">
+ document.write([NSString stringWithString:'E'].toString());
+ </script>
+ <script type="text/cycript">
dlopen("/System/Library/PrivateFrameworks/PhotoLibrary.framework/PhotoLibrary", RTLD_GLOBAL);
var old = [PLCameraAlbum respondsToSelector:@selector(sharedInstance)];
break;
}
- document.write('<img src="' + jpeg + '"/>');
+ document.write('<img src="' + jpeg.toString() + '"/>');
</script></div>
</body></html>