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

Unified Diff: src/api.cc

Issue 1402393003: Ensure JSProxy correctness for PrototypeIterator uses (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: reword comment Created 5 years, 1 month 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 | « no previous file | src/builtins.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 289f7d92336ba39e952fe188689764e182b1b812..393e2e29b4007b9ffbb3f9aaeadaf6aca45af793 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3747,6 +3747,7 @@ Local<Object> v8::Object::FindInstanceInPrototypeChain(
return Local<Object>();
}
}
+ // IsTemplateFor() ensures that iter.GetCurrent() can't be a Proxy here.
return Utils::ToLocal(i::handle(iter.GetCurrent<i::JSObject>(), isolate));
}
@@ -4125,13 +4126,14 @@ MaybeLocal<Value> v8::Object::GetRealNamedPropertyInPrototypeChain(
Local<Context> context, Local<Name> key) {
PREPARE_FOR_EXECUTION(
context, "v8::Object::GetRealNamedPropertyInPrototypeChain()", Value);
- auto self = Utils::OpenHandle(this);
- auto key_obj = Utils::OpenHandle(*key);
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
+ i::Handle<i::Name> key_obj = Utils::OpenHandle(*key);
i::PrototypeIterator iter(isolate, self);
if (iter.IsAtEnd()) return MaybeLocal<Value>();
- auto proto = i::PrototypeIterator::GetCurrent(iter);
+ i::Handle<i::JSReceiver> proto =
+ i::PrototypeIterator::GetCurrent<i::JSReceiver>(iter);
i::LookupIterator it = i::LookupIterator::PropertyOrElement(
- isolate, self, key_obj, i::Handle<i::JSReceiver>::cast(proto),
+ isolate, self, key_obj, proto,
i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
Local<Value> result;
has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result);
@@ -4155,22 +4157,20 @@ v8::Object::GetRealNamedPropertyAttributesInPrototypeChain(
PREPARE_FOR_EXECUTION_PRIMITIVE(
context, "v8::Object::GetRealNamedPropertyAttributesInPrototypeChain()",
PropertyAttribute);
- auto self = Utils::OpenHandle(this);
- auto key_obj = Utils::OpenHandle(*key);
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
+ i::Handle<i::Name> key_obj = Utils::OpenHandle(*key);
i::PrototypeIterator iter(isolate, self);
if (iter.IsAtEnd()) return Nothing<PropertyAttribute>();
- auto proto = i::PrototypeIterator::GetCurrent(iter);
+ i::Handle<i::JSReceiver> proto =
+ i::PrototypeIterator::GetCurrent<i::JSReceiver>(iter);
i::LookupIterator it = i::LookupIterator::PropertyOrElement(
- isolate, self, key_obj, i::Handle<i::JSReceiver>::cast(proto),
+ isolate, self, key_obj, proto,
i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
- auto result = i::JSReceiver::GetPropertyAttributes(&it);
+ Maybe<PropertyAttributes> result = i::JSReceiver::GetPropertyAttributes(&it);
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute);
if (!it.IsFound()) return Nothing<PropertyAttribute>();
- if (result.FromJust() == ABSENT) {
- return Just(static_cast<PropertyAttribute>(NONE));
- }
- return Just<PropertyAttribute>(
- static_cast<PropertyAttribute>(result.FromJust()));
+ if (result.FromJust() == ABSENT) return Just(None);
+ return Just(static_cast<PropertyAttribute>(result.FromJust()));
}
« no previous file with comments | « no previous file | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698