Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Unified Diff: test/cctest/test-api.cc

Issue 696703002: Follow up to fix v8::Exception::GetMessage() actually do what it was intended to. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/isolate.cc ('K') | « src/isolate.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
« src/isolate.cc ('K') | « src/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698