Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index ebcef01aff544a1a6606a87860528e071e97d44e..82eb4aee3cde26783bc9503641b4fc8109c007cf 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -2302,8 +2302,29 @@ MUST_USE_RESULT PropertyAttributes JSProxy::GetPropertyAttributeWithHandler( |
if (result->IsUndefined()) return ABSENT; |
- // TODO(rossberg): convert result to PropertyAttributes |
- return NONE; |
+ bool has_pending_exception; |
+ Object** argv[] = { result.location() }; |
+ Handle<Object> desc = |
+ Execution::Call(isolate->to_complete_property_descriptor(), result, |
+ ARRAY_SIZE(argv), argv, &has_pending_exception); |
+ if (has_pending_exception) return NONE; |
+ |
+ // Convert result to PropertyAttributes. |
+ Handle<String> enum_name = isolate->factory()->LookupAsciiSymbol("enumerable"); |
Kevin Millikin (Chromium)
2011/09/05 13:48:59
It looks like there are a couple of long lines. C
rossberg
2011/09/05 14:07:49
Done.
|
+ Handle<Object> enumerable(v8::internal::GetProperty(desc, enum_name)); |
+ if (isolate->has_pending_exception()) return NONE; |
+ Handle<String> conf_name = isolate->factory()->LookupAsciiSymbol("configurable"); |
+ Handle<Object> configurable(v8::internal::GetProperty(desc, conf_name)); |
+ if (isolate->has_pending_exception()) return NONE; |
+ Handle<String> writ_name = isolate->factory()->LookupAsciiSymbol("writable"); |
+ Handle<Object> writable(v8::internal::GetProperty(desc, writ_name)); |
+ if (isolate->has_pending_exception()) return NONE; |
+ |
+ int attributes = NONE; |
+ if (enumerable->ToBoolean()->IsFalse()) attributes |= DONT_ENUM; |
+ if (configurable->ToBoolean()->IsFalse()) attributes |= DONT_DELETE; |
+ if (writable->ToBoolean()->IsFalse()) attributes |= READ_ONLY; |
+ return static_cast<PropertyAttributes>(attributes); |
} |