To allow access from one context to another they have to have the same security token which is set by context->SetSecurityToken(token).
Have a look at test/cctest/test-api.cc and search for SetSecurityToken. Cheers, -- Mads On Fri, May 7, 2010 at 6:35 AM, Bigcat <[email protected]> wrote: > [code] > > // setup functions > v8::HandleScope handle_scope; > global = v8::ObjectTemplate::New(); > global->Set(v8::String::New("print"), > v8::FunctionTemplate::New(kshell::Print)); > > // create 1st context > v8::Handle<v8::Context> global_context = v8::Context::New(NULL, > global); > > // setup a global variable: temp="this is a test" > v8::Handle<v8::String> temp(v8::String::New("this is a test")); > global_context->Global()->Set(v8::String::New("temp"), temp); > > // create and enter 2nd context > v8::Persistent<v8::Context> context = v8::Context::New(NULL, > global); > v8::Context::Scope context_scope(context); > > // attempt access global_context "temp" here > v8::Handle<v8::Script> script = v8::Script::Compile("temp"); > > // retrive temp value > v8::Handle<v8::Value> result = script->Run(); > > [/code] > > result is empty. > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
