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()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
24888 .FromJust()); | 24886 .FromJust()); |
24889 } | 24887 } |
24890 | 24888 |
24891 // Case 2: Js source file. | 24889 // Case 2: Js source file. |
24892 { | 24890 { |
24893 v8::MaybeLocal<v8::Script> script = | 24891 v8::MaybeLocal<v8::Script> script = |
24894 v8::Script::Compile(context.local(), v8_str(source), &source_script); | 24892 v8::Script::Compile(context.local(), v8_str(source), &source_script); |
24895 CHECK(script.IsEmpty()); | 24893 CHECK(script.IsEmpty()); |
24896 } | 24894 } |
24897 } | 24895 } |
OLD | NEW |