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

Maciej Stachowiak mjs at apple.com
Wed Feb 3 16:15:36 PST 2010


On Feb 3, 2010, at 3:55 PM, Brian J. Tarricone wrote:

> 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?

I don't think it's possible to do this with the JavaScriptCore API.

Regards,
Maciej



More information about the webkit-help mailing list