| 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 2971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2982 CHECK(!name.IsEmpty()); | 2982 CHECK(!name.IsEmpty()); |
| 2983 foo->PrototypeTemplate()->Set(name, v8::FunctionTemplate::New(isolate)); | 2983 foo->PrototypeTemplate()->Set(name, v8::FunctionTemplate::New(isolate)); |
| 2984 v8::Local<v8::Object> new_instance = | 2984 v8::Local<v8::Object> new_instance = |
| 2985 foo->InstanceTemplate()->NewInstance(env.local()).ToLocalChecked(); | 2985 foo->InstanceTemplate()->NewInstance(env.local()).ToLocalChecked(); |
| 2986 CHECK(!new_instance.IsEmpty()); | 2986 CHECK(!new_instance.IsEmpty()); |
| 2987 CHECK(new_instance->Has(env.local(), name).FromJust()); | 2987 CHECK(new_instance->Has(env.local(), name).FromJust()); |
| 2988 } | 2988 } |
| 2989 | 2989 |
| 2990 | 2990 |
| 2991 THREADED_TEST(PrivatePropertiesOnProxies) { | 2991 THREADED_TEST(PrivatePropertiesOnProxies) { |
| 2992 i::FLAG_harmony_proxies = true; | |
| 2993 LocalContext env; | 2992 LocalContext env; |
| 2994 v8::Isolate* isolate = env->GetIsolate(); | 2993 v8::Isolate* isolate = env->GetIsolate(); |
| 2995 v8::HandleScope scope(isolate); | 2994 v8::HandleScope scope(isolate); |
| 2996 | 2995 |
| 2997 v8::Local<v8::Object> target = CompileRun("({})").As<v8::Object>(); | 2996 v8::Local<v8::Object> target = CompileRun("({})").As<v8::Object>(); |
| 2998 v8::Local<v8::Object> handler = CompileRun("({})").As<v8::Object>(); | 2997 v8::Local<v8::Object> handler = CompileRun("({})").As<v8::Object>(); |
| 2999 | 2998 |
| 3000 v8::Local<v8::Proxy> proxy = | 2999 v8::Local<v8::Proxy> proxy = |
| 3001 v8::Proxy::New(env.local(), target, handler).ToLocalChecked(); | 3000 v8::Proxy::New(env.local(), target, handler).ToLocalChecked(); |
| 3002 | 3001 |
| (...skipping 21826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 24829 auto values2 = Local<Function>::Cast( | 24828 auto values2 = Local<Function>::Cast( |
| 24830 object2->Get(env2.local(), v8_str("values")).ToLocalChecked()); | 24829 object2->Get(env2.local(), v8_str("values")).ToLocalChecked()); |
| 24831 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); | 24830 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); |
| 24832 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); | 24831 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); |
| 24833 CHECK_EQ(fn2->GetCreationContext(), *ctx2); | 24832 CHECK_EQ(fn2->GetCreationContext(), *ctx2); |
| 24834 } | 24833 } |
| 24835 } | 24834 } |
| 24836 | 24835 |
| 24837 | 24836 |
| 24838 TEST(Proxy) { | 24837 TEST(Proxy) { |
| 24839 i::FLAG_harmony_proxies = true; | |
| 24840 LocalContext context; | 24838 LocalContext context; |
| 24841 v8::Isolate* isolate = CcTest::isolate(); | 24839 v8::Isolate* isolate = CcTest::isolate(); |
| 24842 v8::HandleScope scope(isolate); | 24840 v8::HandleScope scope(isolate); |
| 24843 v8::Local<v8::Object> target = CompileRun("({})").As<v8::Object>(); | 24841 v8::Local<v8::Object> target = CompileRun("({})").As<v8::Object>(); |
| 24844 v8::Local<v8::Object> handler = CompileRun("({})").As<v8::Object>(); | 24842 v8::Local<v8::Object> handler = CompileRun("({})").As<v8::Object>(); |
| 24845 | 24843 |
| 24846 v8::Local<v8::Proxy> proxy = | 24844 v8::Local<v8::Proxy> proxy = |
| 24847 v8::Proxy::New(context.local(), target, handler).ToLocalChecked(); | 24845 v8::Proxy::New(context.local(), target, handler).ToLocalChecked(); |
| 24848 CHECK(proxy->IsProxy()); | 24846 CHECK(proxy->IsProxy()); |
| 24849 CHECK(!target->IsProxy()); | 24847 CHECK(!target->IsProxy()); |
| 24850 CHECK(!proxy->IsRevoked()); | 24848 CHECK(!proxy->IsRevoked()); |
| 24851 CHECK(proxy->GetTarget()->SameValue(target)); | 24849 CHECK(proxy->GetTarget()->SameValue(target)); |
| 24852 CHECK(proxy->GetHandler()->SameValue(handler)); | 24850 CHECK(proxy->GetHandler()->SameValue(handler)); |
| 24853 | 24851 |
| 24854 proxy->Revoke(); | 24852 proxy->Revoke(); |
| 24855 CHECK(proxy->IsProxy()); | 24853 CHECK(proxy->IsProxy()); |
| 24856 CHECK(!target->IsProxy()); | 24854 CHECK(!target->IsProxy()); |
| 24857 CHECK(proxy->IsRevoked()); | 24855 CHECK(proxy->IsRevoked()); |
| 24858 CHECK(proxy->GetTarget()->SameValue(target)); | 24856 CHECK(proxy->GetTarget()->SameValue(target)); |
| 24859 CHECK(proxy->GetHandler()->IsNull()); | 24857 CHECK(proxy->GetHandler()->IsNull()); |
| 24860 } | 24858 } |
| OLD | NEW |