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

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

Issue 6526016: Properly process try/finally blocks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing Mads' comments Created 9 years, 10 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/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
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index ded42b4b2ece73b907a841540d58665152ec3079..3de5b92d481ce0ef63ba14bdbb107353215e7a34 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -2691,6 +2691,41 @@ THREADED_TEST(CatchExceptionFromWith) {
}
+THREADED_TEST(TryCatchAndFinallyHidingException) {
+ v8::HandleScope scope;
+ LocalContext context;
+ v8::TryCatch try_catch;
+ CHECK(!try_catch.HasCaught());
+ CompileRun("function f(k) { try { this[k]; } finally { return 0; } };");
+ CompileRun("f({toString: function() { throw 42; }});");
+ CHECK(!try_catch.HasCaught());
+}
+
+
+v8::Handle<v8::Value> WithTryCatch(const v8::Arguments& args) {
+ v8::TryCatch try_catch;
+ return v8::Undefined();
+}
+
+
+THREADED_TEST(TryCatchAndFinally) {
+ v8::HandleScope scope;
+ LocalContext context;
+ context->Global()->Set(
+ v8_str("native_with_try_catch"),
+ v8::FunctionTemplate::New(WithTryCatch)->GetFunction());
+ v8::TryCatch try_catch;
+ CHECK(!try_catch.HasCaught());
+ CompileRun(
+ "try {\n"
+ " throw new Error('a');\n"
+ "} finally {\n"
+ " native_with_try_catch();\n"
+ "}\n");
+ CHECK(try_catch.HasCaught());
+}
+
+
THREADED_TEST(Equality) {
v8::HandleScope scope;
LocalContext context;
« 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