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

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

Issue 13173: Fixing exception reporting so that a verbose TryCatch handler works again. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years 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/top.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
===================================================================
--- test/cctest/test-api.cc (revision 922)
+++ test/cctest/test-api.cc (working copy)
@@ -1666,6 +1666,55 @@
}
+THREADED_TEST(APIThrowTryCatch) {
+ v8::HandleScope scope;
+ Local<ObjectTemplate> templ = ObjectTemplate::New();
+ templ->Set(v8_str("ThrowFromC"),
+ v8::FunctionTemplate::New(ThrowFromC));
+ LocalContext context(0, templ);
+ v8::TryCatch try_catch;
+ CompileRun("ThrowFromC();");
+ CHECK(try_catch.HasCaught());
+}
+
+
+static void receive_message(v8::Handle<v8::Message> message,
+ v8::Handle<v8::Value> data) {
+ message_received = true;
+}
+
+
+TEST(APIThrowMessage) {
+ message_received = false;
+ v8::HandleScope scope;
+ v8::V8::AddMessageListener(receive_message);
+ Local<ObjectTemplate> templ = ObjectTemplate::New();
+ templ->Set(v8_str("ThrowFromC"),
+ v8::FunctionTemplate::New(ThrowFromC));
+ LocalContext context(0, templ);
+ CompileRun("ThrowFromC();");
+ CHECK(message_received);
+ v8::V8::RemoveMessageListeners(check_message);
+}
+
+
+TEST(APIThrowMessageAndVerboseTryCatch) {
+ message_received = false;
+ v8::HandleScope scope;
+ v8::V8::AddMessageListener(receive_message);
+ Local<ObjectTemplate> templ = ObjectTemplate::New();
+ templ->Set(v8_str("ThrowFromC"),
+ v8::FunctionTemplate::New(ThrowFromC));
+ LocalContext context(0, templ);
+ v8::TryCatch try_catch;
+ try_catch.SetVerbose(true);
+ CompileRun("ThrowFromC();");
+ CHECK(try_catch.HasCaught());
+ CHECK(message_received);
+ v8::V8::RemoveMessageListeners(check_message);
+}
+
+
THREADED_TEST(ExternalScriptException) {
v8::HandleScope scope;
Local<ObjectTemplate> templ = ObjectTemplate::New();
« no previous file with comments | « src/top.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698