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

Reply via email to