Is there any reason for "Context::New" to ignore the internal field
count of the global object template?
I recently upgraded from 556 to 710 (and beyond) revisions and noted
the lack of this functionality (the internal field count is not being
migrated to the proxy template inside your api).
I'm using that feature to get access to my C++ processor object from
v8 static function template callbacks. I'm not sure if this is the
best approach in my specific architectural needs, but it is terribly
simple to implement this way.
In order to confirm the behaviour:
// define a scope
HandleScope scope_temp;
// the global object template
Handle<ObjectTemplate> template_global = ObjectTemplate::New();
// the template characteristic that will be ignored by the
Context::New constructor
template_global->SetInternalFieldCount(1);
// create the context using our template
Handle<Context> context = Context::New(0, template_global);
// then I got a surprise
cout << "global object internal field count: " << context->Global
()->InternalFieldCount() << endl;
I'm currently using this unofficial "fix" as a lazy temporary
workaround:
[api.cc]
Persistent<Context> v8::Context::New...
...
// Migrate the internal field count.
proxy_template->SetInternalFieldCount(global_template-
>InternalFieldCount());
global_template = proxy_template;
...
Thank you for v8, it is a pleasure to develop with it (besides your
naming conventions.. lol).
Best Regards,
Christian Kuesters
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---