Index: test/cctest/test-api.cc |
=================================================================== |
--- test/cctest/test-api.cc (revision 904) |
+++ test/cctest/test-api.cc (working copy) |
@@ -2960,6 +2960,7 @@ |
// Counts uncaught exceptions, but other tests running in parallel |
// also have uncaught exceptions. |
TEST(ApiUncaughtException) { |
+ report_count = 0; |
v8::HandleScope scope; |
LocalContext env; |
v8::V8::AddMessageListener(ApiUncaughtExceptionTestListener); |
@@ -2983,9 +2984,43 @@ |
CHECK(trouble_caller->IsFunction()); |
Function::Cast(*trouble_caller)->Call(global, 0, NULL); |
CHECK_EQ(1, report_count); |
+ v8::V8::RemoveMessageListeners(ApiUncaughtExceptionTestListener); |
} |
+TEST(TryCatchFinallyUsingMessaging) { |
Søren Thygesen Gjesse
2008/12/04 07:53:53
I suggest to change this test into one or more mes
olehougaard
2008/12/04 08:44:35
Fixed.
|
+ report_count = 0; |
+ v8::HandleScope scope; |
+ LocalContext env; |
+ v8::V8::AddMessageListener(ApiUncaughtExceptionTestListener); |
+ Script::Compile(v8_str("try { throw ''; } catch (e) {}"))->Run(); |
+ CHECK_EQ(0, report_count); |
+ Script::Compile(v8_str("try { throw ''; } finally {}"))->Run(); |
+ CHECK_EQ(1, report_count); |
+ Script::Compile(v8_str("(function() { try { throw ''; } finally { return; } })()"))->Run(); |
Mads Ager (chromium)
2008/12/03 15:44:48
These two lines seem too long? Break them by usin
olehougaard
2008/12/04 08:44:35
Fixed
|
+ CHECK_EQ(1, report_count); |
+ Script::Compile(v8_str("(function() { try { throw ''; } finally { throw 0; } })()"))->Run(); |
+ CHECK_EQ(2, report_count); |
+ v8::V8::RemoveMessageListeners(ApiUncaughtExceptionTestListener); |
+} |
+ |
+ |
+TEST(TryCatchFinallyUsingTryCatchHandler) { |
+ v8::HandleScope scope; |
+ LocalContext env; |
+ v8::TryCatch try_catch; |
+ Script::Compile(v8_str("try { throw ''; } catch (e) {}"))->Run(); |
+ CHECK(!try_catch.HasCaught()); |
+ Script::Compile(v8_str("try { throw ''; } finally {}"))->Run(); |
+ CHECK(try_catch.HasCaught()); |
+ try_catch.Reset(); |
+ Script::Compile(v8_str("(function() { try { throw ''; } finally { return; } })()"))->Run(); |
+ CHECK(!try_catch.HasCaught()); |
+ Script::Compile(v8_str("(function() { try { throw ''; } finally { throw 0; } })()"))->Run(); |
+ CHECK(try_catch.HasCaught()); |
+} |
+ |
+ |
// SecurityHandler can't be run twice |
TEST(SecurityHandler) { |
v8::HandleScope scope0; |