[webkit-dev] Extending WebKit JavaScript support

Iulian iliescu.iulian at gmail.com
Tue Nov 18 06:31:32 PST 2008

I think i got it.
What its not clear for me now is how to build and test my sample code?
I just build-it using gcc?
How the browser (the one provided with WebKit) will be able to "see" my

Kalle Vahlman wrote:
> 2008/11/13 Christian Dywan <christian at twotoasts.de>:
>> Am Thu, 13 Nov 2008 01:34:17 -0800 (PST)
>> schrieb Iulian <iliescu.iulian at gmail.com>:
>>> I would like to extend JavaScript support with new objects (similar
>>> to Math, RegEx, String). Because these objects needs to interact with
>>> the OS (Linux) i cannot use JavaScript Object support to create these
>>> objects from JavaScript.
>>> I studied WebKit documentation but i don't know what should i do to
>>> add such an object.
>> Heya,
>> if Linux means Gtk, something like the following will do:
>>    JSClassDefinition js_class_def = kJSClassDefinitionEmpty;
>>    js_class_def.className = g_strdup (name);
>>    js_class_def.getPropertyNames = _js_class_get_property_names_cb;
>>    js_class_def.hasProperty = _js_class_has_property_cb;
>>    js_class_def.getProperty = _js_class_get_property_cb;
>>    js_class_def.setProperty = _js_class_set_property_cb;
>>    JSClassRef js_class = JSClassCreate (&js_class_def);
>>    JSObjectRef js_object = JSObjectMake (js_context, js_class,
>>    instance);
>> Where you need to implement the underscore prefixed functions yourself.
>> For more pointers I suggest the public headers of JavaScriptCore, the
>> two test programmes, and the file gjs.c in the Midori source tree. The
>> API of javascript is pretty intuitive once you got the hang of it.
> This might be of interest too as an example, it creates a DBus JS
> object with two methods (which are implemented in C) and few (static)
> properties for JS application usage:
> http://sandbox.movial.com/gitweb?p=browser-dbus-bridge.git;a=blob;f=jscorebus/jscorebus.c#l392
> -- 
> Kalle Vahlman, zuh at iki.fi
> Powered by http://movial.fi
> Interesting stuff at http://sandbox.movial.com
> See also http://syslog.movial.fi
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

View this message in context: http://www.nabble.com/Extending-WebKit-JavaScript-support-tp20477434p20560708.html
Sent from the Webkit mailing list archive at Nabble.com.

More information about the webkit-dev mailing list