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 2868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2879 child->SetPrototype(obj); | 2879 child->SetPrototype(obj); |
2880 CHECK(child->Has(sym1)); | 2880 CHECK(child->Has(sym1)); |
2881 CHECK_EQ(2002, child->Get(sym1)->Int32Value()); | 2881 CHECK_EQ(2002, child->Get(sym1)->Int32Value()); |
2882 CHECK(obj->Get(sym3)->Equals(v8::Integer::New(isolate, 42))); | 2882 CHECK(obj->Get(sym3)->Equals(v8::Integer::New(isolate, 42))); |
2883 CHECK(obj->Get(v8::String::NewFromUtf8(isolate, "accessor_sym3"))->Equals( | 2883 CHECK(obj->Get(v8::String::NewFromUtf8(isolate, "accessor_sym3"))->Equals( |
2884 v8::Integer::New(isolate, 42))); | 2884 v8::Integer::New(isolate, 42))); |
2885 CHECK_EQ(0, child->GetOwnPropertyNames()->Length()); | 2885 CHECK_EQ(0, child->GetOwnPropertyNames()->Length()); |
2886 } | 2886 } |
2887 | 2887 |
2888 | 2888 |
| 2889 THREADED_TEST(SymbolTemplateProperties) { |
| 2890 LocalContext env; |
| 2891 v8::Isolate* isolate = env->GetIsolate(); |
| 2892 v8::HandleScope scope(isolate); |
| 2893 v8::Local<v8::FunctionTemplate> foo = v8::FunctionTemplate::New(isolate); |
| 2894 v8::Local<v8::Name> name = v8::Symbol::New(isolate); |
| 2895 CHECK(!name.IsEmpty()); |
| 2896 foo->PrototypeTemplate()->Set(name, v8::FunctionTemplate::New(isolate)); |
| 2897 v8::Local<v8::Object> new_instance = foo->InstanceTemplate()->NewInstance(); |
| 2898 CHECK(!new_instance.IsEmpty()); |
| 2899 CHECK(new_instance->Has(name)); |
| 2900 } |
| 2901 |
| 2902 |
2889 THREADED_TEST(PrivateProperties) { | 2903 THREADED_TEST(PrivateProperties) { |
2890 LocalContext env; | 2904 LocalContext env; |
2891 v8::Isolate* isolate = env->GetIsolate(); | 2905 v8::Isolate* isolate = env->GetIsolate(); |
2892 v8::HandleScope scope(isolate); | 2906 v8::HandleScope scope(isolate); |
2893 | 2907 |
2894 v8::Local<v8::Object> obj = v8::Object::New(isolate); | 2908 v8::Local<v8::Object> obj = v8::Object::New(isolate); |
2895 v8::Local<v8::Private> priv1 = v8::Private::New(isolate); | 2909 v8::Local<v8::Private> priv1 = v8::Private::New(isolate); |
2896 v8::Local<v8::Private> priv2 = | 2910 v8::Local<v8::Private> priv2 = |
2897 v8::Private::New(isolate, v8_str("my-private")); | 2911 v8::Private::New(isolate, v8_str("my-private")); |
2898 | 2912 |
(...skipping 20046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22945 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); | 22959 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); |
22946 Local<Function> set = | 22960 Local<Function> set = |
22947 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); | 22961 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); |
22948 Local<Function> get = | 22962 Local<Function> get = |
22949 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); | 22963 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); |
22950 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); | 22964 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); |
22951 Handle<Value> args[] = { v8_num(14) }; | 22965 Handle<Value> args[] = { v8_num(14) }; |
22952 set->Call(x, 1, args); | 22966 set->Call(x, 1, args); |
22953 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); | 22967 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); |
22954 } | 22968 } |
OLD | NEW |