On 28 June 2012 00:45, Vyacheslav Egorov <[email protected]> wrote: > Unfortunately no. Normal JavaScript objects do not work with > ReattachGlobal. It expects JSGlobalProxy (which cannot be created > through an API separately from a Context). Quoting v8.h: > > /** > * Reattaches a global object to a context. This can be used to > * restore the connection between a global object and a context > * after DetachGlobal has been called. > * > * \param global_object The global object to reattach to the > * context. For this to work, the global object must be the global > * object that was associated with this context before a call to > * DetachGlobal. > */ > void ReattachGlobal(Handle<Object> global_object);
FWIW, this definitely needs to be fixed in the foreseeable future. In ES6, you will be able to use module loaders to run code with arbitrary user objects as the global object (including things like proxies). Our special case hacking with the GlobalObject class has to go away. I'm not looking forward to this change, though... /Andreas -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
