You cannot create an object without having entered a context. Also,
the object that you pass into Context::New is supposed to be a global
object created from the object template that you pass into the
Context::New call. The object is then completely reinitialized based
on the object template. The only thing that survives is the object
identity of the object (which is needed in a browser setting).
If you want to add stuff to your global object, create an object
template, add the stuff to the object template and pass it to
Context::New.
Cheers, -- Mads
On Mon, Oct 13, 2008 at 3:13 PM, <[EMAIL PROTECTED]> wrote:
>
>> Do you have a HandleScope in effect when this is done?
>>
>> HandleScope hscope;
>> Handle<Object> global = Object::New();
>>
>> --
>> Bryan White
>
> Yes, HandleScope is the first line in function.
> You can try to test a simple case:
>
> #include "v8.h"
> using namespace v8;
>
> void main()
> {
> HandleScope handle_scope;
> Handle<Object> obj = Object::New(); // ---------> assert failed.
> Persistent<Context> context = Context::New(0,
> Handle<ObjectTemplate>(), obj);
> if (!context.IsEmpty())
> {
> context.Dispose();
> context.Clear();
> }
> return;
> }
> >
>
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---