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

Unified Diff: test/cctest/test-thread-termination.cc

Issue 2037363002: [json] check and handle interrupts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 6 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/json-stringifier.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-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;
« no previous file with comments | « src/json-stringifier.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698