LibJS: Don't assume [[GetOwnPropertyDescriptor]] always succeeds

It can fail if we're talking to a badly-behaved proxy when enumerating
object properties for iteration.
This commit is contained in:
Andreas Kling 2025-03-19 13:23:38 -05:00 committed by Andreas Kling
commit 660d533b50
Notes: github-actions[bot] 2025-03-20 17:52:44 +00:00
2 changed files with 14 additions and 0 deletions

View file

@ -0,0 +1,12 @@
test("iterate over bogus proxy", () => {
expect(() => {
let proxy = new Proxy([123], {
getOwnPropertyDescriptor: function (p) {
return undefined;
},
});
for (const p in proxy) {
}
}).toThrow();
});