1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:07:36 +00:00

LibJS: Consider non-extensible objects in Reflect.setPrototypeOf()

This commit is contained in:
Linus Groh 2020-06-02 12:39:02 +01:00 committed by Andreas Kling
parent c1248a7fd8
commit b32761f2e0
2 changed files with 6 additions and 4 deletions

View file

@ -28,10 +28,14 @@ try {
assert(Reflect.setPrototypeOf({}, Reflect.getPrototypeOf({})) === true);
var o = {};
var p = { foo: "bar" };
assert(o.foo === undefined);
assert(Reflect.setPrototypeOf(o, { foo: "bar" }) === true);
assert(Reflect.setPrototypeOf(o, p) === true);
assert(o.foo === "bar");
Reflect.preventExtensions(o);
assert(Reflect.setPrototypeOf(o, {}) === false);
assert(Reflect.setPrototypeOf(o, p) === true);
console.log("PASS");
} catch (e) {