/** Returns the context that is on the top of the stack. */
static Local<Context> GetCurrent();
+ static Local<Context> GetCurrent(Isolate* isolate);
/**
* Returns the context of the calling JavaScript code. That is the
}
+v8::Local<v8::Context> Context::GetCurrent(Isolate* exported_isolate) {
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(exported_isolate);
+ ASSERT(isolate == i::Isolate::Current());
+ i::Handle<i::Object> current = isolate->native_context();
+ if (current.is_null()) return Local<Context>();
+ i::Handle<i::Context> context = i::Handle<i::Context>::cast(current);
+ return Utils::ToLocal(context);
+}
+
+
v8::Local<v8::Context> Context::GetCalling() {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::Context::GetCalling()")) {
static v8::Handle<Value> GetCallingContextCallback(const v8::Arguments& args) {
ApiTestFuzzer::Fuzz();
CHECK(Context::GetCurrent() == calling_context0);
+ CHECK(Context::GetCurrent(args.GetIsolate()) == calling_context0);
CHECK(Context::GetCalling() == calling_context1);
CHECK(Context::GetEntered() == calling_context2);
return v8::Integer::New(42);