Reproduction
Reflect.ownKeys(new Proxy({}, { ownKeys: () => 0 }));
Expected
A TypeError is thrown.
V8 (15.3.27):
d8> Reflect.ownKeys(new Proxy({}, { ownKeys: () => 0 }));
TypeError: CreateListFromArrayLike called on non-object
Actual (QuickJS-ng)
QuickJS-ng treats the primitive result as an empty key list:
qjs > Reflect.ownKeys(new Proxy({}, { ownKeys: () => 0 }));
[]
Spec
The Proxy [[OwnPropertyKeys]] method passes the result of the ownKeys trap to CreateListFromArrayLike.
CreateListFromArrayLike must throw a TypeError when its argument is not an Object. Since 0 is a Number primitive, the call must throw instead of returning an empty array.
Versions
- QuickJS-ng: 0.16.0
- V8: 15.3.27
Reproduction
Expected
A
TypeErroris thrown.V8 (15.3.27):
Actual (QuickJS-ng)
QuickJS-ng treats the primitive result as an empty key list:
Spec
The Proxy
[[OwnPropertyKeys]]method passes the result of theownKeystrap toCreateListFromArrayLike.CreateListFromArrayLikemust throw aTypeErrorwhen its argument is not an Object. Since0is a Number primitive, the call must throw instead of returning an empty array.Versions