mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:57:46 +00:00
LibJS: Make ObjectPrototype an immutable prototype exotic object
To make this happen, this patch implements the SetImmutablePrototype abstract operation (as a method on Object) and then overrides [[SetPrototypeOf]] on ObjectPrototype.
This commit is contained in:
parent
fac8f9a94d
commit
cb20baebae
5 changed files with 41 additions and 0 deletions
|
@ -3,3 +3,10 @@ test("basic functionality", () => {
|
|||
Object.prototype.foo = 123;
|
||||
expect(o.foo).toBe(123);
|
||||
});
|
||||
|
||||
test("is an immutable prototype exotic object", () => {
|
||||
const p = Object.create(null);
|
||||
expect(() => {
|
||||
Object.setPrototypeOf(Object.prototype, p);
|
||||
}).toThrowWithMessage(TypeError, "Object's [[SetPrototypeOf]] method returned false");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue