summaryrefslogtreecommitdiff
path: root/src/js.c
diff options
context:
space:
mode:
authorportix <none@none>2012-10-23 01:00:42 +0200
committerportix <none@none>2012-10-23 01:00:42 +0200
commit1bf336e63e1c46a3005d1e4d555d294dd45a9af0 (patch)
treeb55d987a4a31a07701a5f52c6b9fb5ad0dd553ae /src/js.c
parent371935c5857ff7440f2fd1e29d28c1bd2918e7cf (diff)
downloaddwb-1bf336e63e1c46a3005d1e4d555d294dd45a9af0.zip
Fixing element hider issues with webkit-1.10
Diffstat (limited to 'src/js.c')
-rw-r--r--src/js.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/js.c b/src/js.c
index 02a83618..1e5246d1 100644
--- a/src/js.c
+++ b/src/js.c
@@ -167,7 +167,7 @@ js_create_object(WebKitWebFrame *frame, const char *script) {
/* js_call_as_function(WebKitWebFrame, JSObjectRef, char *string, char *json, * char **ret) {{{*/
char *
-js_call_as_function(WebKitWebFrame *frame, JSObjectRef obj, const char *string, const char *json, char **char_ret) {
+js_call_as_function(WebKitWebFrame *frame, JSObjectRef obj, const char *string, const char *json, JSType arg_type, char **char_ret) {
char *ret = NULL;
JSValueRef js_ret, function, v = NULL;
JSObjectRef function_object;
@@ -187,9 +187,18 @@ js_call_as_function(WebKitWebFrame *frame, JSObjectRef obj, const char *string,
function = JSObjectGetProperty(ctx, obj, js_name, NULL);
function_object = JSValueToObject(ctx, function, NULL);
if (json != NULL) {
- js_json = JSStringCreateWithUTF8CString(json);
- v = JSValueMakeFromJSONString(ctx, js_json);
- JSStringRelease(js_json);
+ switch(arg_type) {
+ case kJSTypeObject :
+ js_json = JSStringCreateWithUTF8CString(json);
+ v = JSValueMakeFromJSONString(ctx, js_json);
+ JSStringRelease(js_json);
+ break;
+ case kJSTypeString :
+ v = js_char_to_value(ctx, json);
+ break;
+ default :
+ break;
+ }
}
if (v) {
JSValueRef vals[] = { v };