[webkit-help] looking up classes via JavaScriptCore C API

Brian J. Tarricone brian at tarricone.org
Wed Feb 3 15:55:53 PST 2010


For a specialized application, I need to add new event classes to the 
browser's JS context, and I want to make them subclasses of the 
DOM-defined Event and UIEvent classes.  However, I'm not sure how to do 
this.  The JSClassDefinition struct has a parentClass member, but I 
don't see anything in the API that allows me to look up an existing 
JSClassRef.

The closest I can think to do is to get the global object from the 
JSContextRef, look up the class name as a property, and then get the 
class' prototype, but I'm not sure where to go from there (or even if 
that's a workable approach).

The idea is to hook into the WebKitWebView::window-object-cleared signal 
(I'm using webkit-gtk) and add the new classes to the passed 
JSGlobalContextRef.

Any ideas?  Is this even possible to do with the public JavaScriptCore API?

Thanks,
Brian


More information about the webkit-help mailing list