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

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to