Hello,

I'm trying to fix some code that creates a wrapped C++ object ("Canvas", 
emulating HTMLCanvasElement) with property accessors on the prototype. 
Specifically, these assertions should work to reflect browsers' 
HTMLCanvasElement API:

var c = new Canvas(...);
assert(!c.hasOwnProperty("width"));
assert("width" in c);
assert(HTMLCanvasElement.prototype.hasOwnProperty("width"));

Currently there's an assertion failure (from nan) because the 
InternalFieldCount for the PrototypeTemplate is 0. Setting it to 1 fixes 
this problem, but without touching the rest of the code, both the 
FunctionTemplate and the PrototypeTemplate now have an InternalFieldCount 
of 1. Is that the correct situation? I can't find any examples of setting 
accessors on prototypes to work from.

The class in question is 
this: https://github.com/Automattic/node-canvas/blob/master/src/Canvas.cc#L30 
(sorry it uses nan's macros and not raw v8 APIs)
and the patch setting the PrototypeTemplate's InternalFieldCount is 
https://github.com/Automattic/node-canvas/issues/803#issuecomment-244275154

Thanks,
Zach

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to