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 5403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5414 v8::TryCatch try_catch; | 5414 v8::TryCatch try_catch; |
5415 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); | 5415 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); |
5416 templ->Set(v8_str("TryCatchNativeHelper"), | 5416 templ->Set(v8_str("TryCatchNativeHelper"), |
5417 v8::FunctionTemplate::New(isolate, TryCatchNativeHelper)); | 5417 v8::FunctionTemplate::New(isolate, TryCatchNativeHelper)); |
5418 LocalContext context(0, templ); | 5418 LocalContext context(0, templ); |
5419 CompileRun("TryCatchNativeHelper();"); | 5419 CompileRun("TryCatchNativeHelper();"); |
5420 CHECK(!try_catch.HasCaught()); | 5420 CHECK(!try_catch.HasCaught()); |
5421 } | 5421 } |
5422 | 5422 |
5423 | 5423 |
| 5424 void TryCatchNativeResetHelper( |
| 5425 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 5426 ApiTestFuzzer::Fuzz(); |
| 5427 v8::TryCatch try_catch; |
| 5428 args.GetIsolate()->ThrowException(v8_str("boom")); |
| 5429 CHECK(try_catch.HasCaught()); |
| 5430 try_catch.Reset(); |
| 5431 CHECK(!try_catch.HasCaught()); |
| 5432 } |
| 5433 |
| 5434 |
| 5435 TEST(TryCatchNativeReset) { |
| 5436 v8::Isolate* isolate = CcTest::isolate(); |
| 5437 v8::HandleScope scope(isolate); |
| 5438 v8::V8::Initialize(); |
| 5439 v8::TryCatch try_catch; |
| 5440 Local<ObjectTemplate> templ = ObjectTemplate::New(isolate); |
| 5441 templ->Set(v8_str("TryCatchNativeResetHelper"), |
| 5442 v8::FunctionTemplate::New(isolate, TryCatchNativeResetHelper)); |
| 5443 LocalContext context(0, templ); |
| 5444 CompileRun("TryCatchNativeResetHelper();"); |
| 5445 CHECK(!try_catch.HasCaught()); |
| 5446 } |
| 5447 |
| 5448 |
5424 THREADED_TEST(Equality) { | 5449 THREADED_TEST(Equality) { |
5425 LocalContext context; | 5450 LocalContext context; |
5426 v8::Isolate* isolate = context->GetIsolate(); | 5451 v8::Isolate* isolate = context->GetIsolate(); |
5427 v8::HandleScope scope(context->GetIsolate()); | 5452 v8::HandleScope scope(context->GetIsolate()); |
5428 // Check that equality works at all before relying on CHECK_EQ | 5453 // Check that equality works at all before relying on CHECK_EQ |
5429 CHECK(v8_str("a")->Equals(v8_str("a"))); | 5454 CHECK(v8_str("a")->Equals(v8_str("a"))); |
5430 CHECK(!v8_str("a")->Equals(v8_str("b"))); | 5455 CHECK(!v8_str("a")->Equals(v8_str("b"))); |
5431 | 5456 |
5432 CHECK_EQ(v8_str("a"), v8_str("a")); | 5457 CHECK_EQ(v8_str("a"), v8_str("a")); |
5433 CHECK_NE(v8_str("a"), v8_str("b")); | 5458 CHECK_NE(v8_str("a"), v8_str("b")); |
(...skipping 17402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22836 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); | 22861 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); |
22837 Local<Function> set = | 22862 Local<Function> set = |
22838 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); | 22863 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); |
22839 Local<Function> get = | 22864 Local<Function> get = |
22840 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); | 22865 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); |
22841 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); | 22866 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); |
22842 Handle<Value> args[] = { v8_num(14) }; | 22867 Handle<Value> args[] = { v8_num(14) }; |
22843 set->Call(x, 1, args); | 22868 set->Call(x, 1, args); |
22844 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); | 22869 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); |
22845 } | 22870 } |
OLD | NEW |