Commit 1c7c6551 authored by ager@chromium.org's avatar ager@chromium.org

Make sure to set property attributes in GetProperty in the case of

failed access checks.

Added assert to GetPropertyWithReceiver which was hit by our tests in
debug mode.
Review URL: http://codereview.chromium.org/13242

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@934 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8d801258
...@@ -147,7 +147,9 @@ Object* Object::GetPropertyWithReceiver(Object* receiver, ...@@ -147,7 +147,9 @@ Object* Object::GetPropertyWithReceiver(Object* receiver,
PropertyAttributes* attributes) { PropertyAttributes* attributes) {
LookupResult result; LookupResult result;
Lookup(name, &result); Lookup(name, &result);
return GetProperty(receiver, &result, name, attributes); Object* value = GetProperty(receiver, &result, name, attributes);
ASSERT(*attributes <= ABSENT);
return value;
} }
...@@ -215,9 +217,11 @@ Object* Object::GetPropertyWithCallback(Object* receiver, ...@@ -215,9 +217,11 @@ Object* Object::GetPropertyWithCallback(Object* receiver,
// Only deal with CALLBACKS and INTERCEPTOR // Only deal with CALLBACKS and INTERCEPTOR
Object* JSObject::GetPropertyWithFailedAccessCheck(Object* receiver, Object* JSObject::GetPropertyWithFailedAccessCheck(
LookupResult* result, Object* receiver,
String* name) { LookupResult* result,
String* name,
PropertyAttributes* attributes) {
if (result->IsValid()) { if (result->IsValid()) {
switch (result->type()) { switch (result->type()) {
case CALLBACKS: { case CALLBACKS: {
...@@ -226,6 +230,7 @@ Object* JSObject::GetPropertyWithFailedAccessCheck(Object* receiver, ...@@ -226,6 +230,7 @@ Object* JSObject::GetPropertyWithFailedAccessCheck(Object* receiver,
if (obj->IsAccessorInfo()) { if (obj->IsAccessorInfo()) {
AccessorInfo* info = AccessorInfo::cast(obj); AccessorInfo* info = AccessorInfo::cast(obj);
if (info->all_can_read()) { if (info->all_can_read()) {
*attributes = result->GetAttributes();
return GetPropertyWithCallback(receiver, return GetPropertyWithCallback(receiver,
result->GetCallbackObject(), result->GetCallbackObject(),
name, name,
...@@ -241,7 +246,10 @@ Object* JSObject::GetPropertyWithFailedAccessCheck(Object* receiver, ...@@ -241,7 +246,10 @@ Object* JSObject::GetPropertyWithFailedAccessCheck(Object* receiver,
LookupResult r; LookupResult r;
result->holder()->LookupRealNamedPropertyInPrototypes(name, &r); result->holder()->LookupRealNamedPropertyInPrototypes(name, &r);
if (r.IsValid()) { if (r.IsValid()) {
return GetPropertyWithFailedAccessCheck(receiver, &r, name); return GetPropertyWithFailedAccessCheck(receiver,
&r,
name,
attributes);
} }
break; break;
} }
...@@ -251,9 +259,11 @@ Object* JSObject::GetPropertyWithFailedAccessCheck(Object* receiver, ...@@ -251,9 +259,11 @@ Object* JSObject::GetPropertyWithFailedAccessCheck(Object* receiver,
LookupResult r; LookupResult r;
result->holder()->LookupRealNamedProperty(name, &r); result->holder()->LookupRealNamedProperty(name, &r);
if (r.IsValid()) { if (r.IsValid()) {
return GetPropertyWithFailedAccessCheck(receiver, &r, name); return GetPropertyWithFailedAccessCheck(receiver,
&r,
name,
attributes);
} }
break;
} }
default: { default: {
break; break;
...@@ -261,6 +271,8 @@ Object* JSObject::GetPropertyWithFailedAccessCheck(Object* receiver, ...@@ -261,6 +271,8 @@ Object* JSObject::GetPropertyWithFailedAccessCheck(Object* receiver,
} }
} }
// No accessible property found.
*attributes = ABSENT;
Top::ReportFailedAccessCheck(this, v8::ACCESS_GET); Top::ReportFailedAccessCheck(this, v8::ACCESS_GET);
return Heap::undefined_value(); return Heap::undefined_value();
} }
...@@ -402,7 +414,8 @@ Object* Object::GetProperty(Object* receiver, ...@@ -402,7 +414,8 @@ Object* Object::GetProperty(Object* receiver,
if (!Top::MayNamedAccess(checked, name, v8::ACCESS_GET)) { if (!Top::MayNamedAccess(checked, name, v8::ACCESS_GET)) {
return checked->GetPropertyWithFailedAccessCheck(receiver, return checked->GetPropertyWithFailedAccessCheck(receiver,
result, result,
name); name,
attributes);
} }
} }
// Stop traversing the chain once we reach the last object in the // Stop traversing the chain once we reach the last object in the
......
...@@ -1185,7 +1185,8 @@ class JSObject: public HeapObject { ...@@ -1185,7 +1185,8 @@ class JSObject: public HeapObject {
// Used from Object::GetProperty(). // Used from Object::GetProperty().
Object* GetPropertyWithFailedAccessCheck(Object* receiver, Object* GetPropertyWithFailedAccessCheck(Object* receiver,
LookupResult* result, LookupResult* result,
String* name); String* name,
PropertyAttributes* attributes);
Object* GetPropertyWithInterceptor(JSObject* receiver, Object* GetPropertyWithInterceptor(JSObject* receiver,
String* name, String* name,
PropertyAttributes* attributes); PropertyAttributes* attributes);
......
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