mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:47:36 +00:00
LibJS: Add missing cyclic prototype check to Object.setPrototypeOf()
This commit is contained in:
parent
ebb40e7d7b
commit
4e555fae22
2 changed files with 30 additions and 4 deletions
|
@ -40,4 +40,14 @@ describe("errors", () => {
|
|||
|
||||
expect(Object.setPrototypeOf(o, p)).toBe(o);
|
||||
});
|
||||
|
||||
test("cyclic prototype chain", () => {
|
||||
let o = {};
|
||||
let p = {};
|
||||
Object.setPrototypeOf(o, p);
|
||||
|
||||
expect(() => {
|
||||
Object.setPrototypeOf(p, o);
|
||||
}).toThrowWithMessage(TypeError, "Object's [[SetPrototypeOf]] method returned false");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue