Interceptors on global object?

23 views
Skip to first unread message

Ale

unread,
Dec 4, 2009, 4:24:50 PM12/4/09
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

Ale

unread,
Dec 5, 2009, 7:14:10 PM12/5/09
to v8-users
Please disregard this. Sorry for the noise.
Reply all
Reply to author
Forward
0 new messages