Dear Sirs:
I decide to use the JavascriptCore's API of the Webkit-1.2.7 to do some
interactions between C code and javascript. Now I find it difficultied to get
an appropriate JSContextRef when I intend to use it to call a Javascript
function in the native C method. I have tried some functions in the
JSContextRef.h, but it seemed that did not work well.
Here is part of my codes:
...
static void
on_foo(gpointer user_data)
{
...
JSGlobalContextRef context = JSGlobalContextCreateInGroup(NULL, NULL);
JSStringRef body = JSStringCreateWithUTF8CString("alert(\"Hello World\");");
JSObjectRef function = JSObjectMakeFunction(context, NULL, 0, NULL, body,
NULL, 0, NULL);
JSValueRef result = JSObjectCallAsFunction(context,function, NULL, 0, NULL,
0);
...
}
...
on_foo is a native callback in C code part and it seems that the javascript
function "alert()" will not be called due to the context object not handling
well. So how should I modify my code to build a right jscontext ref ?
Thanks.
_______________________________________________
webkit-help mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-help