Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 89255f239162193febb11df4bee2dbe25da3aa19..bdda382ea3e29003f2dba744d47555e90bbc6966 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -22714,3 +22714,29 @@ TEST(ScriptNameAndLineNumber) { |
int line_number = script->GetUnboundScript()->GetLineNumber(0); |
CHECK_EQ(13, line_number); |
} |
+ |
+ |
+Local<v8::Context> call_eval_context; |
+Local<v8::Function> call_eval_bound_function; |
+static void CallEval(const v8::FunctionCallbackInfo<v8::Value>& args) { |
+ v8::Context::Scope scope(call_eval_context); |
+ args.GetReturnValue().Set( |
+ call_eval_bound_function->Call(call_eval_context->Global(), 0, NULL)); |
+} |
+ |
+ |
+TEST(CrossActivationEval) { |
+ LocalContext env; |
+ v8::Isolate* isolate = env->GetIsolate(); |
+ v8::HandleScope scope(isolate); |
+ { |
+ call_eval_context = v8::Context::New(isolate); |
+ v8::Context::Scope scope(call_eval_context); |
+ call_eval_bound_function = |
+ Local<Function>::Cast(CompileRun("eval.bind(this, '1')")); |
+ } |
+ env->Global()->Set(v8_str("CallEval"), |
+ v8::FunctionTemplate::New(isolate, CallEval)->GetFunction()); |
+ Local<Value> result = CompileRun("CallEval();"); |
+ CHECK_EQ(result, v8::Integer::New(isolate, 1)); |
+} |