Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 09125e1407c1ae84921005737437dc74f79ddf0d..1b240dc4e825942d9db2a72f4a50ca3cab962b1f 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -17478,4 +17478,37 @@ class ThreadInterruptTest { |
THREADED_TEST(SemaphoreInterruption) { |
ThreadInterruptTest().RunTest(); |
} |
+ |
+ |
+TEST(Utf8ValueException) { |
+ v8::HandleScope scope; |
+ LocalContext context; |
+ |
+ Handle<Value> object = CompileRun( |
+ "var obj = { toString : function() { throw 'deadbeef'; } }; obj"); |
+ |
+ { v8::TryCatch try_catch; |
+ v8::String::Utf8Value utf8_value(object); |
+ CHECK(try_catch.HasCaught()); |
+ CHECK_EQ("deadbeef", *v8::String::Utf8Value(try_catch.Exception())); |
+ } |
+ |
+ { v8::TryCatch try_catch; |
+ v8::String::AsciiValue ascii_value(object); |
+ CHECK(try_catch.HasCaught()); |
+ CHECK_EQ("deadbeef", *v8::String::Utf8Value(try_catch.Exception())); |
+ } |
+ |
+ { v8::TryCatch try_catch; |
+ v8::String::Value value(object); |
+ CHECK(try_catch.HasCaught()); |
+ CHECK_EQ("deadbeef", *v8::String::Utf8Value(try_catch.Exception())); |
+ } |
+ |
+ // It should work fine without any TryCatch. |
+ v8::String::Utf8Value utf8_value(object); |
+ v8::String::AsciiValue ascii_value(object); |
+ v8::String::Value value(object); |
+} |
+ |
#endif // WIN32 |