how to create REAL global object in v8? how to create REAL global object in v8? google-chrome google-chrome

how to create REAL global object in v8?


I think that you need to call "alert" with "window.name" instead of just "name".

runJSCode(context, (char*)"window.name =33; alert(window.name);");

"window.name" means a property "name" of object "window", but just "name" means property name of objet "this" (that is in this case the object you get by calling "context->Global()" in C++ code). You set "window" as a property of the global object not as global object.


//Local<Object> obj( Object::New(isolate));//context->Global()->Set( String::NewFromUtf8(isolate, "window"), obj );runJSCode(context, (char*)"window=this; window.name =33; alert(name);");

====so easy -_-!