Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 3bda179712b010834977212ceffa36772927a94a..11b40674b241ccd69b2a47bb6da8cf0f70db3d0e 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -1199,15 +1199,22 @@ MaybeHandle<Object> Object::SetElement(Isolate* isolate, Handle<Object> object, |
} |
-Handle<Object> Object::GetPrototypeSkipHiddenPrototypes( |
- Isolate* isolate, Handle<Object> receiver) { |
- PrototypeIterator iter(isolate, receiver); |
- while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) { |
+Handle<Object> Object::GetPrototype(Isolate* isolate, Handle<Object> obj) { |
+ // We don't expect access checks to be needed on JSProxy objects. |
+ DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject()); |
+ Handle<Context> context(isolate->context()); |
+ if (obj->IsAccessCheckNeeded() && |
+ !isolate->MayAccess(context, Handle<JSObject>::cast(obj))) { |
+ return isolate->factory()->null_value(); |
+ } |
+ |
+ PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER); |
+ do { |
+ iter.AdvanceIgnoringProxies(); |
if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { |
return PrototypeIterator::GetCurrent(iter); |
} |
- iter.Advance(); |
- } |
+ } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)); |
return PrototypeIterator::GetCurrent(iter); |
} |