| Index: test/cctest/test-thread-termination.cc
|
| diff --git a/test/cctest/test-thread-termination.cc b/test/cctest/test-thread-termination.cc
|
| index 85dfd13b602fa9abb0294f0772cdbc98bed1a6c3..9d3cbf61960a2a0db75d4b1fb1dac3b1fcedd3f2 100644
|
| --- a/test/cctest/test-thread-termination.cc
|
| +++ b/test/cctest/test-thread-termination.cc
|
| @@ -204,6 +204,31 @@ TEST(TerminateOnlyV8ThreadFromOtherThread) {
|
| semaphore = NULL;
|
| }
|
|
|
| +// Test that execution can be terminated from within JSON.stringify.
|
| +TEST(TerminateJsonStringify) {
|
| + semaphore = new v8::base::Semaphore(0);
|
| + TerminatorThread thread(CcTest::i_isolate());
|
| + thread.Start();
|
| +
|
| + v8::HandleScope scope(CcTest::isolate());
|
| + v8::Local<v8::ObjectTemplate> global =
|
| + CreateGlobalTemplate(CcTest::isolate(), Signal, DoLoop);
|
| + v8::Local<v8::Context> context =
|
| + v8::Context::New(CcTest::isolate(), NULL, global);
|
| + v8::Context::Scope context_scope(context);
|
| + CHECK(!CcTest::isolate()->IsExecutionTerminating());
|
| + v8::MaybeLocal<v8::Value> result =
|
| + CompileRun(CcTest::isolate()->GetCurrentContext(),
|
| + "var x = [];"
|
| + "x[2**31]=1;"
|
| + "terminate();"
|
| + "JSON.stringify(x);"
|
| + "fail();");
|
| + CHECK(result.IsEmpty());
|
| + thread.Join();
|
| + delete semaphore;
|
| + semaphore = NULL;
|
| +}
|
|
|
| int call_count = 0;
|
|
|
|
|