Thanks Anton. Is it possible to retreive the context from the TryCatch, in a exception handler as well?
Thanks, Zaheer On Wed, Aug 10, 2011 at 1:07 AM, Anton Muhin <[email protected]> wrote: > Thanks a lot, Zaheer. > > You've been cc'ed on http://codereview.chromium.org/7552034/ > > yours, > anton. > > On Wed, Aug 10, 2011 at 2:11 AM, Zaheer Ahmad <[email protected]> > wrote: > > hi, > > Iam using "CreationContext" api to identify the context in which the > > JSFunction passed to a native callback is created. It throws an assert > > # > > # Fatal error in src/api.cc, line 3069 > > # CHECK(object->IsJSFunction() && > > i::JSFunction::cast(object)->shared()->IsApiFunction()) failed > > # > > Below is a simplified example that shows the issue. Iam not sure if > there's > > a bug in my code. Could you please take a look. > > Thanks, > > Zaheer > > > > #include <v8.h> > > #include <assert.h> > > using namespace v8; > > Persistent<Context> context; > > Handle<Value> nativeCb(const Arguments &args) { > > assert(args[0]->IsFunction()); > > assert(args[0].As<v8::Object>()->CreationContext() == context); > -->ASSERT > > here > > return Undefined(); > > } > > > > int main(){ > > HandleScope scope; > > V8::Initialize(); > > > > context = Context::New(); > > context->Enter(); > > Local<FunctionTemplate> ft = FunctionTemplate::New(nativeCb); > > context->Global()->Set(String::New("cb"), ft->GetFunction()); > > Script::Compile(String::New("cb(function(){})"))->Run(); > > } > -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
