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

Side by Side Diff: test/cctest/test-thread-termination.cc

Issue 946973004: Revert of Correctly propagate terminate exception in TryCall. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « src/execution.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 TEST(ErrorObjectAfterTermination) { 467 TEST(ErrorObjectAfterTermination) {
468 v8::Isolate* isolate = CcTest::isolate(); 468 v8::Isolate* isolate = CcTest::isolate();
469 v8::HandleScope scope(isolate); 469 v8::HandleScope scope(isolate);
470 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate()); 470 v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
471 v8::Context::Scope context_scope(context); 471 v8::Context::Scope context_scope(context);
472 v8::V8::TerminateExecution(isolate); 472 v8::V8::TerminateExecution(isolate);
473 v8::Local<v8::Value> error = v8::Exception::Error(v8_str("error")); 473 v8::Local<v8::Value> error = v8::Exception::Error(v8_str("error"));
474 // TODO(yangguo): crbug/403509. Check for empty handle instead. 474 // TODO(yangguo): crbug/403509. Check for empty handle instead.
475 CHECK(error->IsUndefined()); 475 CHECK(error->IsUndefined());
476 } 476 }
477
478
479 void InnerTryCallTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) {
480 CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
481 v8::Handle<v8::Object> global = CcTest::global();
482 v8::Handle<v8::Function> loop =
483 v8::Handle<v8::Function>::Cast(global->Get(v8_str("loop")));
484 i::MaybeHandle<i::Object> result =
485 i::Execution::TryCall(v8::Utils::OpenHandle((*loop)),
486 v8::Utils::OpenHandle((*global)), 0, NULL, NULL);
487 CHECK(result.is_null());
488 CHECK(v8::V8::IsExecutionTerminating(CcTest::isolate()));
489 }
490
491
492 TEST(TerminationInInnerTryCall) {
493 v8::Isolate* isolate = CcTest::isolate();
494 v8::HandleScope scope(isolate);
495 v8::Handle<v8::ObjectTemplate> global_template = CreateGlobalTemplate(
496 CcTest::isolate(), TerminateCurrentThread, DoLoopNoCall);
497 global_template->Set(
498 v8_str("inner_try_call_terminate"),
499 v8::FunctionTemplate::New(isolate, InnerTryCallTerminate));
500 v8::Handle<v8::Context> context =
501 v8::Context::New(CcTest::isolate(), NULL, global_template);
502 v8::Context::Scope context_scope(context);
503 v8::TryCatch try_catch;
504 CompileRun("inner_try_call_terminate()");
505 CHECK(try_catch.HasTerminated());
506 }
OLDNEW
« no previous file with comments | « src/execution.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698