[webkit-dev] prototypes and host objects

Allison Newman demallien at mac.com
Wed Feb 10 06:58:49 PST 2010


Hi,

I have a framework written in C using a hand-rolled class system, and I am trying to create Javascript bindings to use this framework.

So far I have succesfully created objects containing all of the desired methods and properties (with their appropriate getters and setters), correctly handle callbacks etc etc.  BUT, I have hit a problem - I cannot seem to create the prototype for these host objects that I have created.

Specifically, in Javascript, if I write:

    var host_object = new MyHostObject();

host_object.prototype resolves as [undefined].

I have tried setting the prototype of objects created in the various callAsConstructor callbacks that I have implemented, by calling JSObjectSetPrototype, but this doesn't seem to have any effect, and I have also tried setting the class attributes in the class reference to kJSClassAttributeNoAutomaticPrototype also to no avail. Maybe I am not making the call in the right place? Or is there another step that I am missing?

Does anybody have a working example of doing this correctly? Or even a suggestion for what I am doing wrong?

Thanks in advance,

Alli


More information about the webkit-dev mailing list