diff options
Diffstat (limited to 'CyteKit')
-rw-r--r-- | CyteKit/WebViewController.mm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/CyteKit/WebViewController.mm b/CyteKit/WebViewController.mm index 643c2b8..5846a66 100644 --- a/CyteKit/WebViewController.mm +++ b/CyteKit/WebViewController.mm @@ -38,6 +38,8 @@ extern NSString * const kCAFilterNearest; #define lprintf(args...) fprintf(stderr, args) +JSValueRef (*$JSObjectCallAsFunction)(JSContextRef, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef *); + // XXX: centralize these special class things to some file or mechanism? static Class $MFMailComposeViewController; @@ -138,6 +140,14 @@ float CYScrollViewDecelerationRateNormal; + (void) _initialize { [WebPreferences _setInitialDefaultTextEncodingToSystemEncoding]; + void *js(NULL); + if (js == NULL) + js = dlopen("/System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore", RTLD_GLOBAL | RTLD_LAZY); + if (js == NULL) + js = dlopen("/System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore", RTLD_GLOBAL | RTLD_LAZY); + if (js != NULL) + $JSObjectCallAsFunction = reinterpret_cast<JSValueRef (*)(JSContextRef, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef *)>(dlsym(js, "JSObjectCallAsFunction")); + dlopen("/System/Library/Frameworks/MessageUI.framework/MessageUI", RTLD_GLOBAL | RTLD_LAZY); $MFMailComposeViewController = objc_getClass("MFMailComposeViewController"); @@ -994,7 +1004,8 @@ float CYScrollViewDecelerationRateNormal; JSGlobalContextRef context([frame globalContext]); JSObjectRef object([function JSObject]); - JSObjectCallAsFunction(context, object, NULL, 0, NULL, NULL); + if ($JSObjectCallAsFunction != NULL) + ($JSObjectCallAsFunction)(context, object, NULL, 0, NULL, NULL); } - (void) reloadButtonClicked { |