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

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

Issue 13658: Fixing a bug where a try-finally block obscured a try-catch block when regist... (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 924)
+++ test/cctest/test-api.cc (working copy)
@@ -1648,6 +1648,15 @@
}
+v8::Handle<Value> CCatcher(const v8::Arguments& args) {
+ if (args.Length() < 1) return v8::Boolean::New(false);
+ v8::HandleScope scope;
+ v8::TryCatch try_catch;
+ v8::Script::Compile(args[0]->ToString())->Run();
+ return v8::Boolean::New(try_catch.HasCaught());
+}
+
+
THREADED_TEST(APICatch) {
v8::HandleScope scope;
Local<ObjectTemplate> templ = ObjectTemplate::New();
@@ -1678,6 +1687,25 @@
}
+// Test that a try-finally block doesn't shadow a try-catch block
+// when setting up an external handler.
+THREADED_TEST(TryCatchInTryFinally) {
+ v8::HandleScope scope;
+ Local<ObjectTemplate> templ = ObjectTemplate::New();
+ templ->Set(v8_str("CCatcher"),
+ v8::FunctionTemplate::New(CCatcher));
+ LocalContext context(0, templ);
+ Local<Value> result = CompileRun("try {"
+ " try {"
+ " CCatcher('throw 7;');"
+ " } finally {"
+ " }"
+ "} catch (e) {"
+ "}");
+ CHECK(result->IsTrue());
+}
+
+
static void receive_message(v8::Handle<v8::Message> message,
v8::Handle<v8::Value> data) {
message_received = true;
« 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