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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 static Handle<Object> CreateAccessCheckedObject( | 519 static Handle<Object> CreateAccessCheckedObject( |
520 v8::Isolate* isolate, | 520 v8::Isolate* isolate, |
521 NamedSecurityCallback namedCallback, | 521 NamedSecurityCallback namedCallback, |
522 IndexedSecurityCallback indexedCallback, | 522 IndexedSecurityCallback indexedCallback, |
523 Handle<Value> data = Handle<Value>()) { | 523 Handle<Value> data = Handle<Value>()) { |
524 Handle<ObjectTemplate> tmpl = ObjectTemplate::New(); | 524 Handle<ObjectTemplate> tmpl = ObjectTemplate::New(); |
525 tmpl->SetAccessCheckCallbacks(namedCallback, indexedCallback, data); | 525 tmpl->SetAccessCheckCallbacks(namedCallback, indexedCallback, data); |
526 Handle<Object> instance = tmpl->NewInstance(); | 526 Handle<Object> instance = tmpl->NewInstance(); |
527 Handle<Object> global = instance->CreationContext()->Global(); | 527 Handle<Object> global = instance->CreationContext()->Global(); |
528 global->Set(String::NewFromUtf8(isolate, "obj"), instance); | 528 global->Set(String::NewFromUtf8(isolate, "obj"), instance); |
529 global->Set(kBlockedContextIndex, v8::True()); | 529 global->Set(kBlockedContextIndex, v8::True(isolate)); |
530 return instance; | 530 return instance; |
531 } | 531 } |
532 | 532 |
533 | 533 |
534 TEST(NamedAccessCheck) { | 534 TEST(NamedAccessCheck) { |
535 HarmonyIsolate isolate; | 535 HarmonyIsolate isolate; |
536 const AccessType types[] = { ACCESS_GET, ACCESS_HAS }; | 536 const AccessType types[] = { ACCESS_GET, ACCESS_HAS }; |
537 for (size_t i = 0; i < ARRAY_SIZE(types); ++i) { | 537 for (size_t i = 0; i < ARRAY_SIZE(types); ++i) { |
538 HandleScope scope(isolate.GetIsolate()); | 538 HandleScope scope(isolate.GetIsolate()); |
539 LocalContext context(isolate.GetIsolate()); | 539 LocalContext context(isolate.GetIsolate()); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 TEST(HiddenPropertiesLeakage) { | 754 TEST(HiddenPropertiesLeakage) { |
755 HarmonyIsolate isolate; | 755 HarmonyIsolate isolate; |
756 HandleScope scope(isolate.GetIsolate()); | 756 HandleScope scope(isolate.GetIsolate()); |
757 LocalContext context(isolate.GetIsolate()); | 757 LocalContext context(isolate.GetIsolate()); |
758 CompileRun("var obj = {};" | 758 CompileRun("var obj = {};" |
759 "var records = null;" | 759 "var records = null;" |
760 "var observer = function(r) { records = r };" | 760 "var observer = function(r) { records = r };" |
761 "Object.observe(obj, observer);"); | 761 "Object.observe(obj, observer);"); |
762 Handle<Value> obj = | 762 Handle<Value> obj = |
763 context->Global()->Get(String::NewFromUtf8(isolate.GetIsolate(), "obj")); | 763 context->Global()->Get(String::NewFromUtf8(isolate.GetIsolate(), "obj")); |
764 Handle<Object>::Cast(obj)->SetHiddenValue( | 764 Handle<Object>::Cast(obj) |
765 String::NewFromUtf8(isolate.GetIsolate(), "foo"), Null()); | 765 ->SetHiddenValue(String::NewFromUtf8(isolate.GetIsolate(), "foo"), |
| 766 Null(isolate.GetIsolate())); |
766 CompileRun(""); // trigger delivery | 767 CompileRun(""); // trigger delivery |
767 CHECK(CompileRun("records")->IsNull()); | 768 CHECK(CompileRun("records")->IsNull()); |
768 } | 769 } |
OLD | NEW |