Ale
unread,Dec 4, 2009, 4:24:50 PM12/4/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to v8-users
Hi.
I'm trying to control access to the global object on scripts Run()'d
there. For some reason the interceptors are called with non-global
object (templates) but not called in the global object (template.)
This is mostly taken from code in src/api.cc.
static Handle<Value> ThrowingPropertyHandlerGet(Local<String> key,
const AccessorInfo&) {
return ThrowException(key);
}
static Handle<Value> ThrowingPropertyHandlerSet(Local<String> key,
Local<Value>, const AccessorInfo&) {
ThrowException(key);
return Undefined(); // not the same as v8::Handle<v8::Value>()
}
[...]
Handle<ObjectTemplate> global = ObjectTemplate::New();
global->SetNamedPropertyHandler(ThrowingPropertyHandlerGet,
ThrowingPropertyHandlerSet);
Handle<Context> context = Context::New(NULL, global);
Context::Scope context_scope(context);
[...]
Handle<Value> script_run = script->Run(); // The script adds to
the global object
This is with almost the same code and running almost current dev on OS
X with x64 arch.
Perhaps I'm missing something?
Thanks in advance!
Ale