Hi Soren,
thanks again for you perfectly prompt and educative response. My
confusion was caused by severe mixing of Context scopes and/or
Enter+Exit calls.
I am now really able to enter other context and execute code there. I
am also able to access one context from another. Hower, there is one
task left which is not working yet:
v8::Handle<v8::Value> token = v8::String::New("x");
v8::Context::GetCurrent()->SetSecurityToken(token);
v8::Handle<v8::ObjectTemplate> local = v8::ObjectTemplate::New();
v8::Handle<v8::Context> context = v8::Context::New(NULL, local);
context->SetSecurityToken(token);
context->Enter();
v8::Handle<v8::String> source = v8::String::New("var x = 4");
v8::Handle<v8::Script> script = v8::Script::Compile(source);
script->Run();
context->Exit();
return context->Global();
As you can see, I would like to access the local context's global
object (populated by executing code inside it) and "see" its contents
from outside (my global context). However, the shown code always
returns null.