Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: test/cctest/test-api.cc

Issue 1242123002: Fix GetOwnPropertyNames on access-checked objects (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Handle empty case Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index c09a71484f1a0c2660d694ad5c3bf7d2e45ae0b6..401d559cb7ce88b966bb394efb7582566612c250 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -8724,6 +8724,11 @@ THREADED_TEST(AccessControlGetOwnPropertyNames) {
obj_template->Set(v8_str("x"), v8::Integer::New(isolate, 42));
obj_template->SetAccessCheckCallbacks(AccessAlwaysBlocked, NULL);
+ // Add an accessor accessible by cross-domain JS code.
+ obj_template->SetAccessor(
+ v8_str("accessible_prop"), EchoGetter, EchoSetter, v8::Handle<Value>(),
+ v8::AccessControl(v8::ALL_CAN_READ | v8::ALL_CAN_WRITE));
+
// Create an environment
v8::Local<Context> context0 = Context::New(isolate, NULL, obj_template);
context0->Enter();
@@ -8746,11 +8751,15 @@ THREADED_TEST(AccessControlGetOwnPropertyNames) {
// global object should be blocked by access checks on the global
// proxy object. Accessing the object that requires access checks
// is blocked by the access checks on the object itself.
- value = CompileRun("Object.getOwnPropertyNames(other).length == 0");
- CHECK(value.IsEmpty());
+ value = CompileRun(
+ "var names = Object.getOwnPropertyNames(other);"
+ "names.length == 1 && names[0] == 'accessible_prop';");
+ CHECK(value->BooleanValue());
- value = CompileRun("Object.getOwnPropertyNames(object).length == 0");
- CHECK(value.IsEmpty());
+ value = CompileRun(
+ "var names = Object.getOwnPropertyNames(object);"
+ "names.length == 1 && names[0] == 'accessible_prop';");
+ CHECK(value->BooleanValue());
context1->Exit();
context0->Exit();
@@ -19364,7 +19373,6 @@ TEST(AccessCheckThrows) {
CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')");
CheckCorrectThrow("%GetPropertyNames(other)");
// PROPERTY_ATTRIBUTES_NONE = 0
- CheckCorrectThrow("%GetOwnPropertyNames(other, 0)");
CheckCorrectThrow("%DefineAccessorPropertyUnchecked("
"other, 'x', null, null, 1)");
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698