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 9832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9843 context0->Enter(); | 9843 context0->Enter(); |
9844 | 9844 |
9845 v8::Local<v8::Object> global0 = context0->Global(); | 9845 v8::Local<v8::Object> global0 = context0->Global(); |
9846 | 9846 |
9847 v8::Local<Context> context1 = Context::New(isolate); | 9847 v8::Local<Context> context1 = Context::New(isolate); |
9848 context1->Enter(); | 9848 context1->Enter(); |
9849 v8::Local<v8::Object> global1 = context1->Global(); | 9849 v8::Local<v8::Object> global1 = context1->Global(); |
9850 CHECK(global1->Set(context1, v8_str("other"), global0).FromJust()); | 9850 CHECK(global1->Set(context1, v8_str("other"), global0).FromJust()); |
9851 | 9851 |
9852 // Regression test for issue 1154. | 9852 // Regression test for issue 1154. |
9853 CHECK(CompileRun("Object.keys(other).length == 0") | 9853 CHECK(CompileRun("Object.keys(other).length == 1") |
| 9854 ->BooleanValue(context1) |
| 9855 .FromJust()); |
| 9856 CHECK(CompileRun("Object.keys(other)[0] == 'accessible_prop'") |
9854 ->BooleanValue(context1) | 9857 ->BooleanValue(context1) |
9855 .FromJust()); | 9858 .FromJust()); |
9856 CHECK(CompileRun("other.blocked_prop").IsEmpty()); | 9859 CHECK(CompileRun("other.blocked_prop").IsEmpty()); |
9857 | 9860 |
9858 // Regression test for issue 1027. | 9861 // Regression test for issue 1027. |
9859 CompileRun("Object.defineProperty(\n" | 9862 CompileRun("Object.defineProperty(\n" |
9860 " other, 'blocked_prop', {configurable: false})"); | 9863 " other, 'blocked_prop', {configurable: false})"); |
9861 CHECK(CompileRun("other.blocked_prop").IsEmpty()); | 9864 CHECK(CompileRun("other.blocked_prop").IsEmpty()); |
9862 CHECK(CompileRun("Object.getOwnPropertyDescriptor(other, 'blocked_prop')") | 9865 CHECK(CompileRun("Object.getOwnPropertyDescriptor(other, 'blocked_prop')") |
9863 .IsEmpty()); | 9866 .IsEmpty()); |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10726 .ToLocalChecked(); | 10729 .ToLocalChecked(); |
10727 | 10730 |
10728 // Create prototype chain of hidden prototypes. | 10731 // Create prototype chain of hidden prototypes. |
10729 CHECK(o4->SetPrototype(context.local(), o3).FromJust()); | 10732 CHECK(o4->SetPrototype(context.local(), o3).FromJust()); |
10730 CHECK(o3->SetPrototype(context.local(), o2).FromJust()); | 10733 CHECK(o3->SetPrototype(context.local(), o2).FromJust()); |
10731 CHECK(o2->SetPrototype(context.local(), o1).FromJust()); | 10734 CHECK(o2->SetPrototype(context.local(), o1).FromJust()); |
10732 | 10735 |
10733 // Call the runtime version of GetOwnPropertyNames() on the natively | 10736 // Call the runtime version of GetOwnPropertyNames() on the natively |
10734 // created object through JavaScript. | 10737 // created object through JavaScript. |
10735 CHECK(context->Global()->Set(context.local(), v8_str("obj"), o4).FromJust()); | 10738 CHECK(context->Global()->Set(context.local(), v8_str("obj"), o4).FromJust()); |
10736 // PROPERTY_ATTRIBUTES_PRIVATE_SYMBOL = 32 | 10739 // PROPERTY_FILTER_NONE = 0 |
10737 CompileRun("var names = %GetOwnPropertyNames(obj, 32);"); | 10740 CompileRun("var names = %GetOwnPropertyKeys(obj, 0);"); |
10738 | 10741 |
10739 ExpectInt32("names.length", 1006); | 10742 ExpectInt32("names.length", 1006); |
10740 ExpectTrue("names.indexOf(\"baz\") >= 0"); | 10743 ExpectTrue("names.indexOf(\"baz\") >= 0"); |
10741 ExpectTrue("names.indexOf(\"boo\") >= 0"); | 10744 ExpectTrue("names.indexOf(\"boo\") >= 0"); |
10742 ExpectTrue("names.indexOf(\"foo\") >= 0"); | 10745 ExpectTrue("names.indexOf(\"foo\") >= 0"); |
10743 ExpectTrue("names.indexOf(\"fuz1\") >= 0"); | 10746 ExpectTrue("names.indexOf(\"fuz1\") >= 0"); |
10744 ExpectTrue("names.indexOf(\"fuz2\") >= 0"); | 10747 ExpectTrue("names.indexOf(\"fuz2\") >= 0"); |
10745 ExpectFalse("names[1005] == undefined"); | 10748 ExpectFalse("names[1005] == undefined"); |
10746 } | 10749 } |
10747 | 10750 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10790 CHECK(o1->Set(context.local(), sym, v8_num(3)).FromJust()); | 10793 CHECK(o1->Set(context.local(), sym, v8_num(3)).FromJust()); |
10791 o1->SetPrivate(context.local(), | 10794 o1->SetPrivate(context.local(), |
10792 v8::Private::New(context->GetIsolate(), v8_str("h1")), | 10795 v8::Private::New(context->GetIsolate(), v8_str("h1")), |
10793 v8::Integer::New(context->GetIsolate(), 2013)) | 10796 v8::Integer::New(context->GetIsolate(), 2013)) |
10794 .FromJust(); | 10797 .FromJust(); |
10795 | 10798 |
10796 // Call the runtime version of GetOwnPropertyNames() on | 10799 // Call the runtime version of GetOwnPropertyNames() on |
10797 // the natively created object through JavaScript. | 10800 // the natively created object through JavaScript. |
10798 CHECK(context->Global()->Set(context.local(), v8_str("obj"), o2).FromJust()); | 10801 CHECK(context->Global()->Set(context.local(), v8_str("obj"), o2).FromJust()); |
10799 CHECK(context->Global()->Set(context.local(), v8_str("sym"), sym).FromJust()); | 10802 CHECK(context->Global()->Set(context.local(), v8_str("sym"), sym).FromJust()); |
10800 // PROPERTY_ATTRIBUTES_PRIVATE_SYMBOL = 32 | 10803 // PROPERTY_FILTER_NONE = 0 |
10801 CompileRun("var names = %GetOwnPropertyNames(obj, 32);"); | 10804 CompileRun("var names = %GetOwnPropertyKeys(obj, 0);"); |
10802 | 10805 |
10803 ExpectInt32("names.length", 7); | 10806 ExpectInt32("names.length", 7); |
10804 ExpectTrue("names.indexOf(\"foo\") >= 0"); | 10807 ExpectTrue("names.indexOf(\"foo\") >= 0"); |
10805 ExpectTrue("names.indexOf(\"bar\") >= 0"); | 10808 ExpectTrue("names.indexOf(\"bar\") >= 0"); |
10806 ExpectTrue("names.indexOf(\"baz\") >= 0"); | 10809 ExpectTrue("names.indexOf(\"baz\") >= 0"); |
10807 ExpectTrue("names.indexOf(\"n1\") >= 0"); | 10810 ExpectTrue("names.indexOf(\"n1\") >= 0"); |
10808 ExpectTrue("names.indexOf(\"n2\") >= 0"); | 10811 ExpectTrue("names.indexOf(\"n2\") >= 0"); |
10809 ExpectTrue("names.indexOf(sym) >= 0"); | 10812 ExpectTrue("names.indexOf(sym) >= 0"); |
10810 ExpectTrue("names.indexOf(\"mine\") >= 0"); | 10813 ExpectTrue("names.indexOf(\"mine\") >= 0"); |
10811 } | 10814 } |
(...skipping 13010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
23822 env2->Global()->Set(env2.local(), v8_str("obj2"), object2).FromJust()); | 23825 env2->Global()->Set(env2.local(), v8_str("obj2"), object2).FromJust()); |
23823 ExpectString("typeof obj2.values", "function"); | 23826 ExpectString("typeof obj2.values", "function"); |
23824 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); | 23827 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); |
23825 | 23828 |
23826 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); | 23829 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); |
23827 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); | 23830 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); |
23828 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); | 23831 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); |
23829 CHECK_EQ(fn2->GetCreationContext(), *ctx2); | 23832 CHECK_EQ(fn2->GetCreationContext(), *ctx2); |
23830 } | 23833 } |
23831 } | 23834 } |
OLD | NEW |