OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2547 Local<Script> script = Script::Compile(v8_str("throw 'panama!';")); | 2547 Local<Script> script = Script::Compile(v8_str("throw 'panama!';")); |
2548 v8::TryCatch try_catch; | 2548 v8::TryCatch try_catch; |
2549 Local<Value> result = script->Run(); | 2549 Local<Value> result = script->Run(); |
2550 CHECK(result.IsEmpty()); | 2550 CHECK(result.IsEmpty()); |
2551 CHECK(try_catch.HasCaught()); | 2551 CHECK(try_catch.HasCaught()); |
2552 String::AsciiValue exception_value(try_catch.Exception()); | 2552 String::AsciiValue exception_value(try_catch.Exception()); |
2553 CHECK_EQ(*exception_value, "panama!"); | 2553 CHECK_EQ(*exception_value, "panama!"); |
2554 } | 2554 } |
2555 | 2555 |
2556 | 2556 |
| 2557 TEST(TryCatchCustomException) { |
| 2558 v8::HandleScope scope; |
| 2559 LocalContext env; |
| 2560 v8::TryCatch try_catch; |
| 2561 CompileRun("function CustomError() { this.a = 'b'; }" |
| 2562 "(function f() { throw new CustomError(); })();"); |
| 2563 CHECK(try_catch.HasCaught()); |
| 2564 CHECK(try_catch.Exception()->ToObject()-> |
| 2565 Get(v8_str("a"))->Equals(v8_str("b"))); |
| 2566 } |
| 2567 |
| 2568 |
2557 bool message_received; | 2569 bool message_received; |
2558 | 2570 |
2559 | 2571 |
2560 static void check_message_0(v8::Handle<v8::Message> message, | 2572 static void check_message_0(v8::Handle<v8::Message> message, |
2561 v8::Handle<Value> data) { | 2573 v8::Handle<Value> data) { |
2562 CHECK_EQ(6.75, message->GetScriptResourceName()->NumberValue()); | 2574 CHECK_EQ(6.75, message->GetScriptResourceName()->NumberValue()); |
2563 CHECK_EQ(7.56, message->GetScriptData()->NumberValue()); | 2575 CHECK_EQ(7.56, message->GetScriptData()->NumberValue()); |
2564 message_received = true; | 2576 message_received = true; |
2565 } | 2577 } |
2566 | 2578 |
(...skipping 15320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17887 | 17899 |
17888 i::Semaphore* sem_; | 17900 i::Semaphore* sem_; |
17889 volatile int sem_value_; | 17901 volatile int sem_value_; |
17890 }; | 17902 }; |
17891 | 17903 |
17892 | 17904 |
17893 THREADED_TEST(SemaphoreInterruption) { | 17905 THREADED_TEST(SemaphoreInterruption) { |
17894 ThreadInterruptTest().RunTest(); | 17906 ThreadInterruptTest().RunTest(); |
17895 } | 17907 } |
17896 #endif // WIN32 | 17908 #endif // WIN32 |
OLD | NEW |