Commit a3b7c832 authored by dcarney's avatar dcarney Committed by Commit bot

fix attribute lookup for all can read indexed interceptors

R=verwaest@chromium.org

BUG=

Review URL: https://codereview.chromium.org/1034513002

Cr-Commit-Position: refs/heads/master@{#27420}
parent fc168939
...@@ -617,7 +617,7 @@ Maybe<PropertyAttributes> JSObject::GetElementAttributesWithFailedAccessCheck( ...@@ -617,7 +617,7 @@ Maybe<PropertyAttributes> JSObject::GetElementAttributesWithFailedAccessCheck(
FindIndexedAllCanReadHolder(isolate, holder, where_to_start); FindIndexedAllCanReadHolder(isolate, holder, where_to_start);
if (!all_can_read_holder.ToHandle(&holder)) break; if (!all_can_read_holder.ToHandle(&holder)) break;
auto result = auto result =
JSObject::GetElementAttributeFromInterceptor(object, receiver, index); JSObject::GetElementAttributeFromInterceptor(holder, receiver, index);
if (isolate->has_scheduled_exception()) break; if (isolate->has_scheduled_exception()) break;
if (result.IsJust() && result.FromJust() != ABSENT) return result; if (result.IsJust() && result.FromJust() != ABSENT) return result;
where_to_start = PrototypeIterator::START_AT_PROTOTYPE; where_to_start = PrototypeIterator::START_AT_PROTOTYPE;
......
...@@ -3024,15 +3024,27 @@ THREADED_TEST(NamedAllCanReadInterceptor) { ...@@ -3024,15 +3024,27 @@ THREADED_TEST(NamedAllCanReadInterceptor) {
access_check_data.result = true; access_check_data.result = true;
ExpectInt32("checked.whatever", 17); ExpectInt32("checked.whatever", 17);
CHECK_EQ(1, access_check_data.count); CHECK(!CompileRun("Object.getOwnPropertyDescriptor(checked, 'whatever')")
->IsUndefined());
CHECK_EQ(2, access_check_data.count);
access_check_data.result = false; access_check_data.result = false;
ExpectInt32("checked.whatever", intercept_data_0.value); ExpectInt32("checked.whatever", intercept_data_0.value);
CHECK_EQ(2, access_check_data.count); {
v8::TryCatch try_catch(isolate);
CompileRun("Object.getOwnPropertyDescriptor(checked, 'whatever')");
CHECK(try_catch.HasCaught());
}
CHECK_EQ(4, access_check_data.count);
intercept_data_1.should_intercept = true; intercept_data_1.should_intercept = true;
ExpectInt32("checked.whatever", intercept_data_1.value); ExpectInt32("checked.whatever", intercept_data_1.value);
CHECK_EQ(3, access_check_data.count); {
v8::TryCatch try_catch(isolate);
CompileRun("Object.getOwnPropertyDescriptor(checked, 'whatever')");
CHECK(try_catch.HasCaught());
}
CHECK_EQ(6, access_check_data.count);
} }
...@@ -3090,15 +3102,23 @@ THREADED_TEST(IndexedAllCanReadInterceptor) { ...@@ -3090,15 +3102,23 @@ THREADED_TEST(IndexedAllCanReadInterceptor) {
access_check_data.result = true; access_check_data.result = true;
ExpectInt32("checked[15]", 17); ExpectInt32("checked[15]", 17);
CHECK_EQ(1, access_check_data.count); CHECK(!CompileRun("Object.getOwnPropertyDescriptor(checked, '15')")
->IsUndefined());
CHECK_EQ(3, access_check_data.count);
access_check_data.result = false; access_check_data.result = false;
ExpectInt32("checked[15]", intercept_data_0.value); ExpectInt32("checked[15]", intercept_data_0.value);
CHECK_EQ(2, access_check_data.count); // Note: this should throw but without a LookupIterator it's complicated.
CHECK(!CompileRun("Object.getOwnPropertyDescriptor(checked, '15')")
->IsUndefined());
CHECK_EQ(6, access_check_data.count);
intercept_data_1.should_intercept = true; intercept_data_1.should_intercept = true;
ExpectInt32("checked[15]", intercept_data_1.value); ExpectInt32("checked[15]", intercept_data_1.value);
CHECK_EQ(3, access_check_data.count); // Note: this should throw but without a LookupIterator it's complicated.
CHECK(!CompileRun("Object.getOwnPropertyDescriptor(checked, '15')")
->IsUndefined());
CHECK_EQ(9, access_check_data.count);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment