Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 689286f904c7a5a9c8f7d6e2d938d7e337d7b921..15cc7d12c890a33e1bd747209339be6434ee5467 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -16454,6 +16454,24 @@ THREADED_TEST(AllowCodeGenFromStrings) { |
} |
+TEST(SetErrorMessageForCodeGenFromStrings) { |
+ v8::HandleScope scope; |
+ LocalContext context; |
+ TryCatch try_catch; |
+ |
+ Handle<String> message = v8_str("Message") ; |
+ Handle<String> expected_message = v8_str("Uncaught EvalError: Message"); |
+ V8::SetAllowCodeGenerationFromStringsCallback(&CodeGenerationDisallowed); |
+ context->AllowCodeGenerationFromStrings(false); |
+ context->SetErrorMessageForCodeGenerationFromStrings(message); |
+ Handle<Value> result = CompileRun("eval('42')"); |
+ CHECK(result.IsEmpty()); |
+ CHECK(try_catch.HasCaught()); |
+ Handle<String> actual_message = try_catch.Message()->Get(); |
+ CHECK(expected_message->Equals(actual_message)); |
+} |
+ |
+ |
static v8::Handle<Value> NonObjectThis(const v8::Arguments& args) { |
return v8::Undefined(); |
} |