js-sys: Catch exceptions thrown in Reflect APIs

Proxies passed to Reflect APIs can throw for any of these operations and it is a
bit of a mess.
This commit is contained in:
Nick Fitzgerald
2018-09-25 11:55:28 -07:00
parent 6edb871c36
commit e3d2ea2628
10 changed files with 171 additions and 92 deletions

View File

@ -23,3 +23,19 @@ exports.Rectangle2 = class {
return x === y;
}
};
exports.throw_all_the_time = () => new Proxy({}, {
getPrototypeOf() { throw new Error("nope"); },
setPrototypeOf() { throw new Error("nope"); },
isExtensible() { throw new Error("nope"); },
preventExtensions() { throw new Error("nope"); },
getOwnPropertyDescriptor() { throw new Error("nope"); },
defineProperty() { throw new Error("nope"); },
has() { throw new Error("nope"); },
get() { throw new Error("nope"); },
set() { throw new Error("nope"); },
deleteProperty() { throw new Error("nope"); },
ownKeys() { throw new Error("nope"); },
apply() { throw new Error("nope"); },
construct() { throw new Error("nope"); },
});