OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2648 v8::TryCatch try_catch; | 2648 v8::TryCatch try_catch; |
2649 try_catch.SetVerbose(true); | 2649 try_catch.SetVerbose(true); |
2650 Local<Value> result = CompileRun("ThrowFromC();"); | 2650 Local<Value> result = CompileRun("ThrowFromC();"); |
2651 CHECK(try_catch.HasCaught()); | 2651 CHECK(try_catch.HasCaught()); |
2652 CHECK(result.IsEmpty()); | 2652 CHECK(result.IsEmpty()); |
2653 CHECK(message_received); | 2653 CHECK(message_received); |
2654 v8::V8::RemoveMessageListeners(check_message); | 2654 v8::V8::RemoveMessageListeners(check_message); |
2655 } | 2655 } |
2656 | 2656 |
2657 | 2657 |
| 2658 TEST(APIStackOverflowAndVerboseTryCatch) { |
| 2659 message_received = false; |
| 2660 v8::HandleScope scope; |
| 2661 v8::V8::AddMessageListener(receive_message); |
| 2662 LocalContext context; |
| 2663 v8::TryCatch try_catch; |
| 2664 try_catch.SetVerbose(true); |
| 2665 Local<Value> result = CompileRun("function foo() { foo(); } foo();"); |
| 2666 CHECK(try_catch.HasCaught()); |
| 2667 CHECK(result.IsEmpty()); |
| 2668 CHECK(message_received); |
| 2669 v8::V8::RemoveMessageListeners(receive_message); |
| 2670 } |
| 2671 |
| 2672 |
2658 THREADED_TEST(ExternalScriptException) { | 2673 THREADED_TEST(ExternalScriptException) { |
2659 v8::HandleScope scope; | 2674 v8::HandleScope scope; |
2660 Local<ObjectTemplate> templ = ObjectTemplate::New(); | 2675 Local<ObjectTemplate> templ = ObjectTemplate::New(); |
2661 templ->Set(v8_str("ThrowFromC"), | 2676 templ->Set(v8_str("ThrowFromC"), |
2662 v8::FunctionTemplate::New(ThrowFromC)); | 2677 v8::FunctionTemplate::New(ThrowFromC)); |
2663 LocalContext context(0, templ); | 2678 LocalContext context(0, templ); |
2664 | 2679 |
2665 v8::TryCatch try_catch; | 2680 v8::TryCatch try_catch; |
2666 Local<Script> script | 2681 Local<Script> script |
2667 = Script::Compile(v8_str("ThrowFromC(); throw 'panama';")); | 2682 = Script::Compile(v8_str("ThrowFromC(); throw 'panama';")); |
(...skipping 11086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13754 CHECK(func2->CreationContext() == context2); | 13769 CHECK(func2->CreationContext() == context2); |
13755 CheckContextId(func2, 2); | 13770 CheckContextId(func2, 2); |
13756 CHECK(instance2->CreationContext() == context2); | 13771 CHECK(instance2->CreationContext() == context2); |
13757 CheckContextId(instance2, 2); | 13772 CheckContextId(instance2, 2); |
13758 } | 13773 } |
13759 | 13774 |
13760 context1.Dispose(); | 13775 context1.Dispose(); |
13761 context2.Dispose(); | 13776 context2.Dispose(); |
13762 context3.Dispose(); | 13777 context3.Dispose(); |
13763 } | 13778 } |
OLD | NEW |