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

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

Issue 10917236: Not mask exception thrown by toString in String::UtfValue etc. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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
« no previous file with comments | « src/api.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 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
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698