Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 5599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5610 "return true;})()"); | 5610 "return true;})()"); |
| 5611 CHECK(value->IsTrue()); | 5611 CHECK(value->IsTrue()); |
| 5612 | 5612 |
| 5613 context1->Exit(); | 5613 context1->Exit(); |
| 5614 context0->Exit(); | 5614 context0->Exit(); |
| 5615 context1.Dispose(); | 5615 context1.Dispose(); |
| 5616 context0.Dispose(); | 5616 context0.Dispose(); |
| 5617 } | 5617 } |
| 5618 | 5618 |
| 5619 | 5619 |
| 5620 // This is a regression test for issue 1154. | |
| 5621 TEST(AccessControlObjectKeys) { | |
| 5622 v8::HandleScope handle_scope; | |
| 5623 v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); | |
| 5624 | |
| 5625 global_template->SetAccessCheckCallbacks(NamedAccessBlocker, | |
| 5626 IndexedAccessBlocker); | |
| 5627 | |
| 5628 // Add an accessor that is not accessible by cross-domain JS code. | |
| 5629 global_template->SetAccessor(v8_str("blocked_prop"), | |
| 5630 UnreachableGetter, UnreachableSetter, | |
| 5631 v8::Handle<Value>(), | |
| 5632 v8::DEFAULT); | |
| 5633 | |
| 5634 // Create an environment | |
| 5635 v8::Persistent<Context> context0 = Context::New(NULL, global_template); | |
| 5636 context0->Enter(); | |
| 5637 | |
| 5638 v8::Handle<v8::Object> global0 = context0->Global(); | |
| 5639 | |
| 5640 v8::HandleScope scope1; | |
|
Mads Ager (chromium)
2011/02/15 08:56:10
No need for this since you have the handle scope a
Rico
2011/02/15 09:00:52
Done.
| |
| 5641 | |
| 5642 v8::Persistent<Context> context1 = Context::New(); | |
| 5643 context1->Enter(); | |
| 5644 | |
| 5645 v8::Handle<v8::Object> global1 = context1->Global(); | |
| 5646 global1->Set(v8_str("other"), global0); | |
| 5647 | |
| 5648 ExpectTrue("Object.keys(other).indexOf('blocked_prop')==-1"); | |
|
Mads Ager (chromium)
2011/02/15 08:56:10
Spaces around '=='.
Rico
2011/02/15 09:00:52
Done.
| |
| 5649 } | |
| 5650 | |
| 5651 | |
| 5620 static bool GetOwnPropertyNamesNamedBlocker(Local<v8::Object> global, | 5652 static bool GetOwnPropertyNamesNamedBlocker(Local<v8::Object> global, |
| 5621 Local<Value> name, | 5653 Local<Value> name, |
| 5622 v8::AccessType type, | 5654 v8::AccessType type, |
| 5623 Local<Value> data) { | 5655 Local<Value> data) { |
| 5624 return false; | 5656 return false; |
| 5625 } | 5657 } |
| 5626 | 5658 |
| 5627 | 5659 |
| 5628 static bool GetOwnPropertyNamesIndexedBlocker(Local<v8::Object> global, | 5660 static bool GetOwnPropertyNamesIndexedBlocker(Local<v8::Object> global, |
| 5629 uint32_t key, | 5661 uint32_t key, |
| (...skipping 7054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12684 v8::Handle<v8::Function> define_property = | 12716 v8::Handle<v8::Function> define_property = |
| 12685 CompileRun("(function() {" | 12717 CompileRun("(function() {" |
| 12686 " Object.defineProperty(" | 12718 " Object.defineProperty(" |
| 12687 " this," | 12719 " this," |
| 12688 " 1," | 12720 " 1," |
| 12689 " { configurable: true, enumerable: true, value: 3 });" | 12721 " { configurable: true, enumerable: true, value: 3 });" |
| 12690 "})").As<Function>(); | 12722 "})").As<Function>(); |
| 12691 context->DetachGlobal(); | 12723 context->DetachGlobal(); |
| 12692 define_property->Call(proxy, 0, NULL); | 12724 define_property->Call(proxy, 0, NULL); |
| 12693 } | 12725 } |
| OLD | NEW |