Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index da594881bf5c19284b62a96fb5b201a55060aa3e..03ee2a7c527b46ded8d0eb003f94eb8b1ad43856 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -8550,6 +8550,8 @@ static void ThrowV8Exception(const v8::FunctionCallbackInfo<v8::Value>& info) { |
THREADED_TEST(ExceptionGetMessage) { |
LocalContext context; |
v8::HandleScope scope(context->GetIsolate()); |
+ v8::Handle<String> foo_str = v8_str("foo"); |
+ v8::Handle<String> message_str = v8_str("message"); |
v8::V8::SetCaptureStackTraceForUncaughtExceptions(true); |
@@ -8567,8 +8569,6 @@ THREADED_TEST(ExceptionGetMessage) { |
CHECK(try_catch.HasCaught()); |
v8::Handle<v8::Value> error = try_catch.Exception(); |
- v8::Handle<String> foo_str = v8_str("foo"); |
- v8::Handle<String> message_str = v8_str("message"); |
CHECK(error->IsObject()); |
CHECK(error.As<v8::Object>()->Get(message_str)->Equals(foo_str)); |
@@ -8582,6 +8582,30 @@ THREADED_TEST(ExceptionGetMessage) { |
CHECK_EQ(2, stackTrace->GetFrameCount()); |
v8::V8::SetCaptureStackTraceForUncaughtExceptions(false); |
+ |
+ // Now check message location when SetCaptureStackTraceForUncaughtExceptions |
+ // is false. |
+ try_catch.Reset(); |
+ |
+ CompileRun( |
+ "function f2() {\n" |
+ " return throwV8Exception();\n" |
+ "};\n" |
+ "f2();"); |
+ CHECK(try_catch.HasCaught()); |
+ |
+ error = try_catch.Exception(); |
+ CHECK(error->IsObject()); |
+ CHECK(error.As<v8::Object>()->Get(message_str)->Equals(foo_str)); |
+ |
+ message = v8::Exception::GetMessage(error); |
+ CHECK(!message.IsEmpty()); |
+ CHECK_EQ(2, message->GetLineNumber()); |
+ CHECK_EQ(9, message->GetStartColumn()); |
+ |
+ // Should be empty stack trace. |
+ stackTrace = message->GetStackTrace(); |
+ CHECK(stackTrace.IsEmpty()); |
} |