Build environment: macOS 26.5.2
Moddable SDK version:
- Installed via jsvu, so there is no SDK source tree /
git describe.
- Engine reports:
XS 17.9.1, slot 32 bytes, ID 4 bytes
Target device: desktop (host xs)
Description
Object.seal completes successfully when a Proxy's ownKeys trap returns a non-object value.
According to the Proxy [[OwnPropertyKeys]] method, the trap result is passed to CreateListFromArrayLike.
That operation must throw a TypeError if its argument is not an Object. Since 0 is a Number primitive, the call should throw.
Steps to Reproduce
$ xst -e 'Object.seal(new Proxy({}, { ownKeys: () => 0 })); print("completed")'
completed
Expected behavior
A TypeError is thrown.
For comparison, V8 (15.3.27):
$ v8 -e 'try { Object.seal(new Proxy({}, { ownKeys: () => 0 })); } catch (e) { print(e.name); }'
TypeError
Other information
The same issue is directly observable with Reflect.ownKeys, which returns an empty array instead of throwing:
$ xst -e 'print(JSON.stringify(Reflect.ownKeys(new Proxy({}, { ownKeys: () => 0 }))))'
[]
Reflect.ownKeys should also throw a TypeError.
Build environment: macOS 26.5.2
Moddable SDK version:
git describe.XS 17.9.1, slot 32 bytes, ID 4 bytesTarget device: desktop (host
xs)Description
Object.sealcompletes successfully when a Proxy'sownKeystrap returns a non-object value.According to the Proxy
[[OwnPropertyKeys]]method, the trap result is passed toCreateListFromArrayLike.That operation must throw a
TypeErrorif its argument is not an Object. Since 0 is a Number primitive, the call should throw.Steps to Reproduce
$ xst -e 'Object.seal(new Proxy({}, { ownKeys: () => 0 })); print("completed")' completedExpected behavior
A
TypeErroris thrown.For comparison, V8 (15.3.27):
$ v8 -e 'try { Object.seal(new Proxy({}, { ownKeys: () => 0 })); } catch (e) { print(e.name); }' TypeErrorOther information
The same issue is directly observable with
Reflect.ownKeys, which returns an empty array instead of throwing:$ xst -e 'print(JSON.stringify(Reflect.ownKeys(new Proxy({}, { ownKeys: () => 0 }))))' []Reflect.ownKeysshould also throw aTypeError.