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 7536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7547 value = CompileRun("Object.getOwnPropertyNames(object).length == 0"); | 7547 value = CompileRun("Object.getOwnPropertyNames(object).length == 0"); |
7548 CHECK(value->IsTrue()); | 7548 CHECK(value->IsTrue()); |
7549 | 7549 |
7550 context1->Exit(); | 7550 context1->Exit(); |
7551 context0->Exit(); | 7551 context0->Exit(); |
7552 context1.Dispose(context1->GetIsolate()); | 7552 context1.Dispose(context1->GetIsolate()); |
7553 context0.Dispose(context0->GetIsolate()); | 7553 context0.Dispose(context0->GetIsolate()); |
7554 } | 7554 } |
7555 | 7555 |
7556 | 7556 |
| 7557 static v8::Handle<v8::Array> IndexedPropertyEnumerator(const AccessorInfo&) { |
| 7558 v8::Handle<v8::Array> result = v8::Array::New(2); |
| 7559 result->Set(0, v8::Integer::New(7)); |
| 7560 result->Set(1, v8::Object::New()); |
| 7561 return result; |
| 7562 } |
| 7563 |
| 7564 |
7557 static v8::Handle<v8::Array> NamedPropertyEnumerator(const AccessorInfo& info) { | 7565 static v8::Handle<v8::Array> NamedPropertyEnumerator(const AccessorInfo& info) { |
7558 v8::Handle<v8::Array> result = v8::Array::New(1); | 7566 v8::Handle<v8::Array> result = v8::Array::New(2); |
7559 result->Set(0, v8_str("x")); | 7567 result->Set(0, v8_str("x")); |
| 7568 result->Set(1, v8::Object::New()); |
7560 return result; | 7569 return result; |
7561 } | 7570 } |
7562 | 7571 |
7563 | 7572 |
7564 THREADED_TEST(GetOwnPropertyNamesWithInterceptor) { | 7573 THREADED_TEST(GetOwnPropertyNamesWithInterceptor) { |
7565 v8::HandleScope handle_scope; | 7574 v8::HandleScope handle_scope; |
7566 v8::Handle<v8::ObjectTemplate> obj_template = v8::ObjectTemplate::New(); | 7575 v8::Handle<v8::ObjectTemplate> obj_template = v8::ObjectTemplate::New(); |
7567 | 7576 |
| 7577 obj_template->Set(v8_str("7"), v8::Integer::New(7)); |
7568 obj_template->Set(v8_str("x"), v8::Integer::New(42)); | 7578 obj_template->Set(v8_str("x"), v8::Integer::New(42)); |
| 7579 obj_template->SetIndexedPropertyHandler(NULL, NULL, NULL, NULL, |
| 7580 IndexedPropertyEnumerator); |
7569 obj_template->SetNamedPropertyHandler(NULL, NULL, NULL, NULL, | 7581 obj_template->SetNamedPropertyHandler(NULL, NULL, NULL, NULL, |
7570 NamedPropertyEnumerator); | 7582 NamedPropertyEnumerator); |
7571 | 7583 |
7572 LocalContext context; | 7584 LocalContext context; |
7573 v8::Handle<v8::Object> global = context->Global(); | 7585 v8::Handle<v8::Object> global = context->Global(); |
7574 global->Set(v8_str("object"), obj_template->NewInstance()); | 7586 global->Set(v8_str("object"), obj_template->NewInstance()); |
7575 | 7587 |
7576 v8::Handle<Value> value = | 7588 v8::Handle<v8::Value> result = |
7577 CompileRun("Object.getOwnPropertyNames(object).join(',')"); | 7589 CompileRun("Object.getOwnPropertyNames(object)"); |
7578 CHECK_EQ(v8_str("x"), value); | 7590 CHECK(result->IsArray()); |
| 7591 v8::Handle<v8::Array> result_array = v8::Handle<v8::Array>::Cast(result); |
| 7592 CHECK_EQ(3, result_array->Length()); |
| 7593 CHECK(result_array->Get(0)->IsString()); |
| 7594 CHECK(result_array->Get(1)->IsString()); |
| 7595 CHECK(result_array->Get(2)->IsString()); |
| 7596 CHECK_EQ(v8_str("7"), result_array->Get(0)); |
| 7597 CHECK_EQ(v8_str("[object Object]"), result_array->Get(1)); |
| 7598 CHECK_EQ(v8_str("x"), result_array->Get(2)); |
7579 } | 7599 } |
7580 | 7600 |
7581 | 7601 |
7582 static v8::Handle<Value> ConstTenGetter(Local<String> name, | 7602 static v8::Handle<Value> ConstTenGetter(Local<String> name, |
7583 const AccessorInfo& info) { | 7603 const AccessorInfo& info) { |
7584 return v8_num(10); | 7604 return v8_num(10); |
7585 } | 7605 } |
7586 | 7606 |
7587 | 7607 |
7588 THREADED_TEST(CrossDomainAccessors) { | 7608 THREADED_TEST(CrossDomainAccessors) { |
(...skipping 10679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18268 i::Semaphore* sem_; | 18288 i::Semaphore* sem_; |
18269 volatile int sem_value_; | 18289 volatile int sem_value_; |
18270 }; | 18290 }; |
18271 | 18291 |
18272 | 18292 |
18273 THREADED_TEST(SemaphoreInterruption) { | 18293 THREADED_TEST(SemaphoreInterruption) { |
18274 ThreadInterruptTest().RunTest(); | 18294 ThreadInterruptTest().RunTest(); |
18275 } | 18295 } |
18276 | 18296 |
18277 #endif // WIN32 | 18297 #endif // WIN32 |
OLD | NEW |