Index: src/runtime/runtime-object.cc |
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc |
index 2e3fea2bb4282724e3c630c32374bf0210ecd9ee..a97fff848eb3354b08b138282c961a56f5f6aceb 100644 |
--- a/src/runtime/runtime-object.cc |
+++ b/src/runtime/runtime-object.cc |
@@ -896,11 +896,19 @@ RUNTIME_FUNCTION(Runtime_GetOwnElementNames) { |
if (!args[0]->IsJSObject()) { |
return isolate->heap()->undefined_value(); |
} |
- CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
+ |
+ // TODO(cbruni): implement proper prototype lookup like in GetOwnPropertyNames |
+ if (object->IsJSGlobalProxy()) { |
Toon Verwaest
2015/10/01 15:22:47
The JSGlobalProxy might be detached. In that case
|
+ PrototypeIterator iter(isolate, object, |
+ PrototypeIterator::START_AT_RECEIVER); |
+ iter.Advance(); |
+ object = PrototypeIterator::GetCurrent<JSObject>(iter); |
+ } |
- int n = obj->NumberOfOwnElements(NONE); |
+ int n = object->NumberOfOwnElements(NONE); |
Handle<FixedArray> names = isolate->factory()->NewFixedArray(n); |
- obj->GetOwnElementKeys(*names, NONE); |
+ object->GetOwnElementKeys(*names, NONE); |
return *isolate->factory()->NewJSArrayWithElements(names); |
} |