Index: test/cctest/test-object-observe.cc |
diff --git a/test/cctest/test-object-observe.cc b/test/cctest/test-object-observe.cc |
index 37dde078fe97762bb0d720da3522d1f3194de330..07cc772df0eba845e7f489dbdcb7bf1960490f80 100644 |
--- a/test/cctest/test-object-observe.cc |
+++ b/test/cctest/test-object-observe.cc |
@@ -885,3 +885,39 @@ TEST(UseCountObjectGetNotifier) { |
CompileRun("Object.getNotifier(obj)"); |
CHECK_EQ(1, use_counts[v8::Isolate::kObjectObserve]); |
} |
+ |
+ |
+static bool NamedAccessCheckAlwaysAllow(Local<v8::Object> global, |
+ Local<v8::Value> name, |
+ v8::AccessType type, |
+ Local<Value> data) { |
+ return true; |
+} |
+ |
+ |
+TEST(DisallowObserveAccessCheckedObject) { |
+ v8::Isolate* isolate = CcTest::isolate(); |
+ v8::HandleScope scope(isolate); |
+ LocalContext env; |
+ v8::Local<v8::ObjectTemplate> object_template = |
+ v8::ObjectTemplate::New(isolate); |
+ object_template->SetAccessCheckCallbacks(NamedAccessCheckAlwaysAllow, NULL); |
+ env->Global()->Set(v8_str("obj"), object_template->NewInstance()); |
+ v8::TryCatch try_catch(isolate); |
+ CompileRun("Object.observe(obj, function(){})"); |
+ CHECK(try_catch.HasCaught()); |
+} |
+ |
+ |
+TEST(DisallowGetNotifierAccessCheckedObject) { |
+ v8::Isolate* isolate = CcTest::isolate(); |
+ v8::HandleScope scope(isolate); |
+ LocalContext env; |
+ v8::Local<v8::ObjectTemplate> object_template = |
+ v8::ObjectTemplate::New(isolate); |
+ object_template->SetAccessCheckCallbacks(NamedAccessCheckAlwaysAllow, NULL); |
+ env->Global()->Set(v8_str("obj"), object_template->NewInstance()); |
+ v8::TryCatch try_catch(isolate); |
+ CompileRun("Object.getNotifier(obj)"); |
+ CHECK(try_catch.HasCaught()); |
+} |