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

Brian J. Tarricone brian at tarricone.org
Wed Feb 3 17:57:15 PST 2010

On 02/03/2010 04:15 PM, Maciej Stachowiak wrote:
> 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.

So my best bet might be to add new IDL and C++ impl to WebCore/dom/? 
I'd prefer to do it via public API, but if there isn't a better way...


More information about the webkit-help mailing list