I have a functiontemplate for the C++ class MyClass, and its objects have a 
MyClass method mymethod in their prototype.

I can create that object in javascript and call it and it calls back into 
the mymethod FunctionTemplate callback:

mc = new MyClass(); mc.mymethod();  <== works fine


But if I try to create an object with that as its prototype:

child = Object.create(new MyClass()); child.mymethod();


In the mymethod FunctionTemplate, the object contained in info.Holder() 
(and info.This()) has a .GetInternalField(0) == nullptr;

I added a ClassName to the MyClass FunctionTemplate constructor and in the 
call to 

child.mymethod();


if I print out *v8::String::Utf8Value(info.Holder()); in the mymethod 
callback that is about to fail, I get "MyClass".

then I added a data member "int i = rand()" to MyClass and in the callback 
for mymethod() that has a nullptr in its internalfield, if I call 
holder().get(context, "i"), that goes to my c++ getter function and looks 
up the internal field just fine and returns the correct answer.

I'm exceptionally confused.

Thank you for any help.

--Zac

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