| Index: test/cctest/test-api.cc
|
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
| index b95f292b6e1c1763e1eefd64086ed7ebcbc8fe6d..186601883331eb221a0b8f085c0d5d2351c6bbe4 100755
|
| --- a/test/cctest/test-api.cc
|
| +++ b/test/cctest/test-api.cc
|
| @@ -4500,6 +4500,47 @@ TEST(TryCatchNested) {
|
| }
|
|
|
|
|
| +void TryCatchMixedNestingCheck(v8::TryCatch* try_catch) {
|
| + CHECK(try_catch->HasCaught());
|
| + Handle<Message> message = try_catch->Message();
|
| + Handle<Value> resource = message->GetScriptResourceName();
|
| + CHECK_EQ(0, strcmp(*v8::String::Utf8Value(resource), "inner"));
|
| + CHECK_EQ(0, strcmp(*v8::String::Utf8Value(message->Get()),
|
| + "Uncaught Error: a"));
|
| + CHECK_EQ(1, message->GetLineNumber());
|
| + CHECK_EQ(6, message->GetStartColumn());
|
| +}
|
| +
|
| +
|
| +void TryCatchMixedNestingHelper(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| + ApiTestFuzzer::Fuzz();
|
| + v8::TryCatch try_catch;
|
| + CompileRunWithOrigin("throw new Error('a');\n", "inner", 0, 0);
|
| + CHECK(try_catch.HasCaught());
|
| + TryCatchMixedNestingCheck(&try_catch);
|
| + try_catch.ReThrow();
|
| +}
|
| +
|
| +
|
| +// This test ensures that an outer TryCatch in the following situation:
|
| +// C++/TryCatch -> JS -> C++/TryCatch -> JS w/ SyntaxError
|
| +// does not clobber the Message object generated for the inner TryCatch.
|
| +// This exercises the ability of TryCatch.ReThrow() to restore the
|
| +// inner pending Message before throwing the exception again.
|
| +TEST(TryCatchMixedNesting) {
|
| + v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| + v8::V8::Initialize();
|
| + v8::TryCatch try_catch;
|
| + Local<ObjectTemplate> templ = ObjectTemplate::New();
|
| + templ->Set(v8_str("TryCatchMixedNestingHelper"),
|
| + v8::FunctionTemplate::New(TryCatchMixedNestingHelper));
|
| + LocalContext context(0, templ);
|
| + CompileRunWithOrigin("TryCatchMixedNestingHelper();\n", "outer", 1, 1);
|
| + TryCatchMixedNestingCheck(&try_catch);
|
| +}
|
| +
|
| +
|
| THREADED_TEST(Equality) {
|
| LocalContext context;
|
| v8::Isolate* isolate = context->GetIsolate();
|
|
|