OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-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 7801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7812 value = context->Global()->ObjectProtoToString(); | 7812 value = context->Global()->ObjectProtoToString(); |
7813 CHECK(value->IsString() && value->Equals(v8_str("[object global]"))); | 7813 CHECK(value->IsString() && value->Equals(v8_str("[object global]"))); |
7814 | 7814 |
7815 // Check ordinary object | 7815 // Check ordinary object |
7816 Local<Value> object = v8_compile("new Object()")->Run(); | 7816 Local<Value> object = v8_compile("new Object()")->Run(); |
7817 value = object.As<v8::Object>()->ObjectProtoToString(); | 7817 value = object.As<v8::Object>()->ObjectProtoToString(); |
7818 CHECK(value->IsString() && value->Equals(v8_str("[object Object]"))); | 7818 CHECK(value->IsString() && value->Equals(v8_str("[object Object]"))); |
7819 } | 7819 } |
7820 | 7820 |
7821 | 7821 |
| 7822 THREADED_TEST(ObjectGetConstructorName) { |
| 7823 v8::HandleScope scope; |
| 7824 LocalContext context; |
| 7825 v8_compile("function Parent() {};" |
| 7826 "function Child() {};" |
| 7827 "Child.prototype = new Parent();" |
| 7828 "var outer = { inner: function() { } };" |
| 7829 "var p = new Parent();" |
| 7830 "var c = new Child();" |
| 7831 "var x = new outer.inner();")->Run(); |
| 7832 |
| 7833 Local<v8::Value> p = context->Global()->Get(v8_str("p")); |
| 7834 CHECK(p->IsObject() && p->ToObject()->GetConstructorName()->Equals( |
| 7835 v8_str("Parent"))); |
| 7836 |
| 7837 Local<v8::Value> c = context->Global()->Get(v8_str("c")); |
| 7838 CHECK(c->IsObject() && c->ToObject()->GetConstructorName()->Equals( |
| 7839 v8_str("Child"))); |
| 7840 |
| 7841 Local<v8::Value> x = context->Global()->Get(v8_str("x")); |
| 7842 CHECK(x->IsObject() && x->ToObject()->GetConstructorName()->Equals( |
| 7843 v8_str("outer.inner"))); |
| 7844 } |
| 7845 |
| 7846 |
7822 bool ApiTestFuzzer::fuzzing_ = false; | 7847 bool ApiTestFuzzer::fuzzing_ = false; |
7823 i::Semaphore* ApiTestFuzzer::all_tests_done_= | 7848 i::Semaphore* ApiTestFuzzer::all_tests_done_= |
7824 i::OS::CreateSemaphore(0); | 7849 i::OS::CreateSemaphore(0); |
7825 int ApiTestFuzzer::active_tests_; | 7850 int ApiTestFuzzer::active_tests_; |
7826 int ApiTestFuzzer::tests_being_run_; | 7851 int ApiTestFuzzer::tests_being_run_; |
7827 int ApiTestFuzzer::current_; | 7852 int ApiTestFuzzer::current_; |
7828 | 7853 |
7829 | 7854 |
7830 // We are in a callback and want to switch to another thread (if we | 7855 // We are in a callback and want to switch to another thread (if we |
7831 // are currently running the thread fuzzing test). | 7856 // are currently running the thread fuzzing test). |
(...skipping 3935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11767 v8::Context::Scope context_scope(context.local()); | 11792 v8::Context::Scope context_scope(context.local()); |
11768 | 11793 |
11769 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); | 11794 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); |
11770 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); | 11795 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); |
11771 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); | 11796 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); |
11772 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( | 11797 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( |
11773 "var result = []; for (var k in o) result.push(k); result")); | 11798 "var result = []; for (var k in o) result.push(k); result")); |
11774 CHECK_EQ(1, result->Length()); | 11799 CHECK_EQ(1, result->Length()); |
11775 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); | 11800 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); |
11776 } | 11801 } |
OLD | NEW |