| Index: test/cctest/test-api.cc
|
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
| index 1d790a1ad532624169d97f750e924f1a60379d54..d3501992d6e98c0e79ce89cbd0542405d0ae7424 100644
|
| --- a/test/cctest/test-api.cc
|
| +++ b/test/cctest/test-api.cc
|
| @@ -20760,6 +20760,43 @@ TEST(EnqueueMicrotask) {
|
| }
|
|
|
|
|
| +static void MicrotaskExceptionOne(
|
| + const v8::FunctionCallbackInfo<Value>& info) {
|
| + v8::HandleScope scope(info.GetIsolate());
|
| + CompileRun("exception1Calls++;");
|
| + info.GetIsolate()->ThrowException(
|
| + v8::Exception::Error(v8_str("first")));
|
| +}
|
| +
|
| +
|
| +static void MicrotaskExceptionTwo(
|
| + const v8::FunctionCallbackInfo<Value>& info) {
|
| + v8::HandleScope scope(info.GetIsolate());
|
| + CompileRun("exception2Calls++;");
|
| + info.GetIsolate()->ThrowException(
|
| + v8::Exception::Error(v8_str("second")));
|
| +}
|
| +
|
| +
|
| +TEST(RunMicrotasksIgnoresThrownExceptions) {
|
| + LocalContext env;
|
| + v8::Isolate* isolate = env->GetIsolate();
|
| + v8::HandleScope scope(isolate);
|
| + CompileRun(
|
| + "var exception1Calls = 0;"
|
| + "var exception2Calls = 0;");
|
| + isolate->EnqueueMicrotask(
|
| + Function::New(isolate, MicrotaskExceptionOne));
|
| + isolate->EnqueueMicrotask(
|
| + Function::New(isolate, MicrotaskExceptionTwo));
|
| + TryCatch try_catch;
|
| + CompileRun("1+1;");
|
| + CHECK(!try_catch.HasCaught());
|
| + CHECK_EQ(1, CompileRun("exception1Calls")->Int32Value());
|
| + CHECK_EQ(1, CompileRun("exception2Calls")->Int32Value());
|
| +}
|
| +
|
| +
|
| TEST(SetAutorunMicrotasks) {
|
| LocalContext env;
|
| v8::HandleScope scope(env->GetIsolate());
|
|
|