| 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 Handle<Object> global = isolate->GetCurrentContext()->Global(); | 510 Handle<Object> global = isolate->GetCurrentContext()->Global(); |
| 511 return type != ACCESS_KEYS || !global->Has(kBlockedContextIndex); | 511 return type != ACCESS_KEYS || !global->Has(kBlockedContextIndex); |
| 512 } | 512 } |
| 513 | 513 |
| 514 | 514 |
| 515 static Handle<Object> CreateAccessCheckedObject( | 515 static Handle<Object> CreateAccessCheckedObject( |
| 516 v8::Isolate* isolate, | 516 v8::Isolate* isolate, |
| 517 NamedSecurityCallback namedCallback, | 517 NamedSecurityCallback namedCallback, |
| 518 IndexedSecurityCallback indexedCallback, | 518 IndexedSecurityCallback indexedCallback, |
| 519 Handle<Value> data = Handle<Value>()) { | 519 Handle<Value> data = Handle<Value>()) { |
| 520 Handle<ObjectTemplate> tmpl = ObjectTemplate::New(); | 520 Handle<ObjectTemplate> tmpl = ObjectTemplate::New(isolate); |
| 521 tmpl->SetAccessCheckCallbacks(namedCallback, indexedCallback, data); | 521 tmpl->SetAccessCheckCallbacks(namedCallback, indexedCallback, data); |
| 522 Handle<Object> instance = tmpl->NewInstance(); | 522 Handle<Object> instance = tmpl->NewInstance(); |
| 523 Handle<Object> global = instance->CreationContext()->Global(); | 523 Handle<Object> global = instance->CreationContext()->Global(); |
| 524 global->Set(String::NewFromUtf8(isolate, "obj"), instance); | 524 global->Set(String::NewFromUtf8(isolate, "obj"), instance); |
| 525 global->Set(kBlockedContextIndex, v8::True(isolate)); | 525 global->Set(kBlockedContextIndex, v8::True(isolate)); |
| 526 return instance; | 526 return instance; |
| 527 } | 527 } |
| 528 | 528 |
| 529 | 529 |
| 530 TEST(NamedAccessCheck) { | 530 TEST(NamedAccessCheck) { |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 "var observer = function(r) { records = r };" | 757 "var observer = function(r) { records = r };" |
| 758 "Object.observe(obj, observer);"); | 758 "Object.observe(obj, observer);"); |
| 759 Handle<Value> obj = | 759 Handle<Value> obj = |
| 760 context->Global()->Get(String::NewFromUtf8(isolate.GetIsolate(), "obj")); | 760 context->Global()->Get(String::NewFromUtf8(isolate.GetIsolate(), "obj")); |
| 761 Handle<Object>::Cast(obj) | 761 Handle<Object>::Cast(obj) |
| 762 ->SetHiddenValue(String::NewFromUtf8(isolate.GetIsolate(), "foo"), | 762 ->SetHiddenValue(String::NewFromUtf8(isolate.GetIsolate(), "foo"), |
| 763 Null(isolate.GetIsolate())); | 763 Null(isolate.GetIsolate())); |
| 764 CompileRun(""); // trigger delivery | 764 CompileRun(""); // trigger delivery |
| 765 CHECK(CompileRun("records")->IsNull()); | 765 CHECK(CompileRun("records")->IsNull()); |
| 766 } | 766 } |
| OLD | NEW |