OLD | NEW |
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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 } | 510 } |
511 | 511 |
512 | 512 |
513 TEST(ErrorObjectAfterTermination) { | 513 TEST(ErrorObjectAfterTermination) { |
514 v8::Isolate* isolate = CcTest::isolate(); | 514 v8::Isolate* isolate = CcTest::isolate(); |
515 v8::HandleScope scope(isolate); | 515 v8::HandleScope scope(isolate); |
516 v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate()); | 516 v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate()); |
517 v8::Context::Scope context_scope(context); | 517 v8::Context::Scope context_scope(context); |
518 isolate->TerminateExecution(); | 518 isolate->TerminateExecution(); |
519 v8::Local<v8::Value> error = v8::Exception::Error(v8_str("error")); | 519 v8::Local<v8::Value> error = v8::Exception::Error(v8_str("error")); |
520 CHECK(error->IsNativeError()); | 520 // TODO(yangguo): crbug/403509. Check for empty handle instead. |
| 521 CHECK(error->IsUndefined()); |
521 } | 522 } |
522 | 523 |
523 | 524 |
524 void InnerTryCallTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) { | 525 void InnerTryCallTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) { |
525 CHECK(!args.GetIsolate()->IsExecutionTerminating()); | 526 CHECK(!args.GetIsolate()->IsExecutionTerminating()); |
526 v8::Local<v8::Object> global = CcTest::global(); | 527 v8::Local<v8::Object> global = CcTest::global(); |
527 v8::Local<v8::Function> loop = v8::Local<v8::Function>::Cast( | 528 v8::Local<v8::Function> loop = v8::Local<v8::Function>::Cast( |
528 global->Get(CcTest::isolate()->GetCurrentContext(), v8_str("loop")) | 529 global->Get(CcTest::isolate()->GetCurrentContext(), v8_str("loop")) |
529 .ToLocalChecked()); | 530 .ToLocalChecked()); |
530 i::MaybeHandle<i::Object> result = | 531 i::MaybeHandle<i::Object> result = |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 CHECK(value->IsFunction()); | 584 CHECK(value->IsFunction()); |
584 // The first stack check after terminate has been re-requested fails. | 585 // The first stack check after terminate has been re-requested fails. |
585 CHECK(CompileRun("1 + 1").IsEmpty()); | 586 CHECK(CompileRun("1 + 1").IsEmpty()); |
586 CHECK(!isolate->IsExecutionTerminating()); | 587 CHECK(!isolate->IsExecutionTerminating()); |
587 // V8 then recovers. | 588 // V8 then recovers. |
588 v8::Maybe<int32_t> result = CompileRun("2 + 2")->Int32Value( | 589 v8::Maybe<int32_t> result = CompileRun("2 + 2")->Int32Value( |
589 v8::Isolate::GetCurrent()->GetCurrentContext()); | 590 v8::Isolate::GetCurrent()->GetCurrentContext()); |
590 CHECK_EQ(4, result.FromJust()); | 591 CHECK_EQ(4, result.FromJust()); |
591 CHECK(!isolate->IsExecutionTerminating()); | 592 CHECK(!isolate->IsExecutionTerminating()); |
592 } | 593 } |
OLD | NEW |