Chromium Code Reviews| Index: src/objects.cc |
| diff --git a/src/objects.cc b/src/objects.cc |
| index 1157d723701648c2ee2d05c908c4b338722bbeaa..9843caad8dcb4ce8fd275ff9dac3785bafb36b95 100644 |
| --- a/src/objects.cc |
| +++ b/src/objects.cc |
| @@ -2601,6 +2601,36 @@ PropertyAttributes JSReceiver::GetPropertyAttribute(JSReceiver* receiver, |
| } |
| +PropertyAttributes JSReceiver::TryGetPropertyAttribute( |
| + Handle<Object> key, |
| + bool* has_pending_exception) { |
| + Isolate* isolate = GetHeap()->isolate(); |
| + HandleScope scope(isolate); |
| + |
| + Handle<String> name; |
| + if (key->IsString()) { |
| + name = Handle<String>::cast(key); |
| + } else { |
| + bool has_pending_exception = false; |
| + Handle<Object> converted = |
| + Execution::ToString(key, &has_pending_exception); |
| + if (has_pending_exception) return ABSENT; |
| + name = Handle<String>::cast(converted); |
| + } |
| + PropertyAttributes attr = GetPropertyAttributeWithReceiver(this, *name); |
| + |
| + // Throws an exception when the property doesn't exist. |
|
Mads Ager (chromium)
2011/07/15 07:25:51
Let's just return NONE in that case and document t
|
| + if (attr == ABSENT) { |
| + i::Handle<i::Object> error_obj = isolate->factory()->NewReferenceError( |
| + "not_defined", i::HandleVector(&name, 1)); |
| + isolate->Throw(*error_obj); |
| + *has_pending_exception = true; |
| + } |
| + |
| + return attr; |
| +} |
| + |
| + |
| PropertyAttributes JSReceiver::GetLocalPropertyAttribute(String* name) { |
| // Check whether the name is an array index. |
| uint32_t index = 0; |