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 10715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10726 .ToLocalChecked(); | 10726 .ToLocalChecked(); |
10727 | 10727 |
10728 // Create prototype chain of hidden prototypes. | 10728 // Create prototype chain of hidden prototypes. |
10729 CHECK(o4->SetPrototype(context.local(), o3).FromJust()); | 10729 CHECK(o4->SetPrototype(context.local(), o3).FromJust()); |
10730 CHECK(o3->SetPrototype(context.local(), o2).FromJust()); | 10730 CHECK(o3->SetPrototype(context.local(), o2).FromJust()); |
10731 CHECK(o2->SetPrototype(context.local(), o1).FromJust()); | 10731 CHECK(o2->SetPrototype(context.local(), o1).FromJust()); |
10732 | 10732 |
10733 // Call the runtime version of GetOwnPropertyNames() on the natively | 10733 // Call the runtime version of GetOwnPropertyNames() on the natively |
10734 // created object through JavaScript. | 10734 // created object through JavaScript. |
10735 CHECK(context->Global()->Set(context.local(), v8_str("obj"), o4).FromJust()); | 10735 CHECK(context->Global()->Set(context.local(), v8_str("obj"), o4).FromJust()); |
10736 // PROPERTY_ATTRIBUTES_NONE = 0 | 10736 // PROPERTY_ATTRIBUTES_PRIVATE_SYMBOL = 32 |
10737 CompileRun("var names = %GetOwnPropertyNames(obj, 0);"); | 10737 CompileRun("var names = %GetOwnPropertyNames(obj, 32);"); |
10738 | 10738 |
10739 ExpectInt32("names.length", 1006); | 10739 ExpectInt32("names.length", 1006); |
10740 ExpectTrue("names.indexOf(\"baz\") >= 0"); | 10740 ExpectTrue("names.indexOf(\"baz\") >= 0"); |
10741 ExpectTrue("names.indexOf(\"boo\") >= 0"); | 10741 ExpectTrue("names.indexOf(\"boo\") >= 0"); |
10742 ExpectTrue("names.indexOf(\"foo\") >= 0"); | 10742 ExpectTrue("names.indexOf(\"foo\") >= 0"); |
10743 ExpectTrue("names.indexOf(\"fuz1\") >= 0"); | 10743 ExpectTrue("names.indexOf(\"fuz1\") >= 0"); |
10744 ExpectTrue("names.indexOf(\"fuz2\") >= 0"); | 10744 ExpectTrue("names.indexOf(\"fuz2\") >= 0"); |
10745 ExpectFalse("names[1005] == undefined"); | 10745 ExpectFalse("names[1005] == undefined"); |
10746 } | 10746 } |
10747 | 10747 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10790 CHECK(o1->Set(context.local(), sym, v8_num(3)).FromJust()); | 10790 CHECK(o1->Set(context.local(), sym, v8_num(3)).FromJust()); |
10791 o1->SetPrivate(context.local(), | 10791 o1->SetPrivate(context.local(), |
10792 v8::Private::New(context->GetIsolate(), v8_str("h1")), | 10792 v8::Private::New(context->GetIsolate(), v8_str("h1")), |
10793 v8::Integer::New(context->GetIsolate(), 2013)) | 10793 v8::Integer::New(context->GetIsolate(), 2013)) |
10794 .FromJust(); | 10794 .FromJust(); |
10795 | 10795 |
10796 // Call the runtime version of GetOwnPropertyNames() on | 10796 // Call the runtime version of GetOwnPropertyNames() on |
10797 // the natively created object through JavaScript. | 10797 // the natively created object through JavaScript. |
10798 CHECK(context->Global()->Set(context.local(), v8_str("obj"), o2).FromJust()); | 10798 CHECK(context->Global()->Set(context.local(), v8_str("obj"), o2).FromJust()); |
10799 CHECK(context->Global()->Set(context.local(), v8_str("sym"), sym).FromJust()); | 10799 CHECK(context->Global()->Set(context.local(), v8_str("sym"), sym).FromJust()); |
10800 // PROPERTY_ATTRIBUTES_NONE = 0 | 10800 // PROPERTY_ATTRIBUTES_PRIVATE_SYMBOL = 32 |
10801 CompileRun("var names = %GetOwnPropertyNames(obj, 0);"); | 10801 CompileRun("var names = %GetOwnPropertyNames(obj, 32);"); |
10802 | 10802 |
10803 ExpectInt32("names.length", 7); | 10803 ExpectInt32("names.length", 7); |
10804 ExpectTrue("names.indexOf(\"foo\") >= 0"); | 10804 ExpectTrue("names.indexOf(\"foo\") >= 0"); |
10805 ExpectTrue("names.indexOf(\"bar\") >= 0"); | 10805 ExpectTrue("names.indexOf(\"bar\") >= 0"); |
10806 ExpectTrue("names.indexOf(\"baz\") >= 0"); | 10806 ExpectTrue("names.indexOf(\"baz\") >= 0"); |
10807 ExpectTrue("names.indexOf(\"n1\") >= 0"); | 10807 ExpectTrue("names.indexOf(\"n1\") >= 0"); |
10808 ExpectTrue("names.indexOf(\"n2\") >= 0"); | 10808 ExpectTrue("names.indexOf(\"n2\") >= 0"); |
10809 ExpectTrue("names.indexOf(sym) >= 0"); | 10809 ExpectTrue("names.indexOf(sym) >= 0"); |
10810 ExpectTrue("names.indexOf(\"mine\") >= 0"); | 10810 ExpectTrue("names.indexOf(\"mine\") >= 0"); |
10811 } | 10811 } |
(...skipping 13016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
23828 env2->Global()->Set(env2.local(), v8_str("obj2"), object2).FromJust()); | 23828 env2->Global()->Set(env2.local(), v8_str("obj2"), object2).FromJust()); |
23829 ExpectString("typeof obj2.values", "function"); | 23829 ExpectString("typeof obj2.values", "function"); |
23830 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); | 23830 CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); |
23831 | 23831 |
23832 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); | 23832 auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); |
23833 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); | 23833 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); |
23834 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); | 23834 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); |
23835 CHECK_EQ(fn2->GetCreationContext(), *ctx2); | 23835 CHECK_EQ(fn2->GetCreationContext(), *ctx2); |
23836 } | 23836 } |
23837 } | 23837 } |
OLD | NEW |