| Index: test/cctest/test-object-observe.cc
|
| diff --git a/test/cctest/test-object-observe.cc b/test/cctest/test-object-observe.cc
|
| index a8cbaf6ea75a49902e63bd75607fdc8860c62ca2..0ade6aa04f9395c152f8c10e3416461a90b4a4c1 100644
|
| --- a/test/cctest/test-object-observe.cc
|
| +++ b/test/cctest/test-object-observe.cc
|
| @@ -712,6 +712,46 @@ TEST(AccessCheckDisallowApiModifications) {
|
| }
|
|
|
|
|
| +static bool NamedAccessAlwaysDisallowed(Local<Object>, Local<Value>, AccessType,
|
| + Local<Value>) {
|
| + return false;
|
| +}
|
| +
|
| +
|
| +static bool IndexedAccessAlwaysDisallowed(Local<Object>, uint32_t, AccessType,
|
| + Local<Value>) {
|
| + return false;
|
| +}
|
| +
|
| +
|
| +TEST(AccessCheckedGlobalProxy) {
|
| + HandleScope scope(CcTest::isolate());
|
| + Handle<ObjectTemplate> global_template =
|
| + ObjectTemplate::New(CcTest::isolate());
|
| + global_template->SetAccessCheckCallbacks(NamedAccessAlwaysDisallowed,
|
| + IndexedAccessAlwaysDisallowed);
|
| + Handle<Context> context =
|
| + Context::New(CcTest::isolate(), NULL, global_template);
|
| + Handle<Object> global_proxy = context->Global();
|
| + {
|
| + LocalContext context2(CcTest::isolate());
|
| + context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "global"),
|
| + global_proxy);
|
| + CompileRun("var records = null;"
|
| + "var observer = function(r) { records = r };"
|
| + "Object.observe(global, observer);");
|
| +
|
| + {
|
| + Context::Scope context_scope(context);
|
| + CompileRun("foo = 42");
|
| + CHECK_EQ(42, CompileRun("foo")->Int32Value());
|
| + }
|
| + CHECK(CompileRun("records")->IsNull());
|
| + CHECK(CompileRun("global.foo")->IsUndefined());
|
| + }
|
| +}
|
| +
|
| +
|
| TEST(HiddenPropertiesLeakage) {
|
| HandleScope scope(CcTest::isolate());
|
| LocalContext context(CcTest::isolate());
|
|
|