mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:38:10 +00:00
LibJS: Don't assume Object.setPrototypeOf() prototype value is an object
We're crashing otherwise. Also it was not possible to set the prototype to null.
This commit is contained in:
parent
1a64bdd80c
commit
8cf1ded478
2 changed files with 18 additions and 1 deletions
|
@ -3,6 +3,13 @@ load("test-common.js");
|
|||
try {
|
||||
assert(Object.setPrototypeOf.length === 2);
|
||||
|
||||
assertThrowsError(() => {
|
||||
Object.setPrototypeOf({}, "foo");
|
||||
}, {
|
||||
error: TypeError,
|
||||
message: "Prototype must be null or object"
|
||||
});
|
||||
|
||||
o = {};
|
||||
assert(Object.setPrototypeOf(o, {}) === o);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue