Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 6e19af4ed5c19c7a0fadb34d2f82451f8ad64efb..cc3a2882f95ba54a8f4b500fcd9a484bb65948cb 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -3757,6 +3757,14 @@ static Local<Value> GetPropertyByLookup(i::LookupIterator* it) { |
} |
+static Maybe<PropertyAttribute> GetPropertyAttributesByLookup( |
+ i::LookupIterator* it) { |
+ Maybe<PropertyAttributes> attr = i::JSReceiver::GetPropertyAttributes(it); |
+ if (!it->IsFound()) return Maybe<PropertyAttribute>(); |
+ return Maybe<PropertyAttribute>(static_cast<PropertyAttribute>(attr.value)); |
+} |
+ |
+ |
Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( |
Handle<String> key) { |
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
@@ -3775,6 +3783,24 @@ Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( |
} |
+Maybe<PropertyAttribute> |
+v8::Object::GetRealNamedPropertyAttributesInPrototypeChain(Handle<String> key) { |
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
+ ON_BAILOUT(isolate, |
+ "v8::Object::GetRealNamedPropertyAttributesInPrototypeChain()", |
+ return Maybe<PropertyAttribute>()); |
+ ENTER_V8(isolate); |
+ i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); |
+ i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
+ i::PrototypeIterator iter(isolate, self_obj); |
+ if (iter.IsAtEnd()) return Maybe<PropertyAttribute>(); |
+ i::Handle<i::Object> proto = i::PrototypeIterator::GetCurrent(iter); |
+ i::LookupIterator it(self_obj, key_obj, i::Handle<i::JSReceiver>::cast(proto), |
+ i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
+ return GetPropertyAttributesByLookup(&it); |
+} |
+ |
+ |
Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { |
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
ON_BAILOUT(isolate, "v8::Object::GetRealNamedProperty()", |
@@ -3788,6 +3814,20 @@ Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { |
} |
+Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes( |
+ Handle<String> key) { |
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
+ ON_BAILOUT(isolate, "v8::Object::GetRealNamedPropertyAttributes()", |
+ return Maybe<PropertyAttribute>()); |
+ ENTER_V8(isolate); |
+ i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); |
+ i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
+ i::LookupIterator it(self_obj, key_obj, |
+ i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
+ return GetPropertyAttributesByLookup(&it); |
+} |
+ |
+ |
// Turns on access checks by copying the map and setting the check flag. |
// Because the object gets a new map, existing inline cache caching |
// the old map of this object will fail. |