mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:17:35 +00:00
LibJS: Guard against stack overflow in ProxyObject set_property()
For similar reason as in the previous commit.
This commit is contained in:
parent
52a5a42147
commit
5d2e915623
2 changed files with 34 additions and 1 deletions
|
@ -112,3 +112,20 @@ describe("[[Set]] invariants", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
test("Proxy handler that has the Proxy itself as its prototype", () => {
|
||||
const handler = {};
|
||||
const proxy = new Proxy({}, handler);
|
||||
handler.__proto__ = proxy;
|
||||
expect(() => {
|
||||
proxy["foo"] = "bar";
|
||||
}).toThrowWithMessage(InternalError, "Call stack size limit exceeded");
|
||||
});
|
||||
|
||||
test("Proxy that has the Proxy itself as its prototype", () => {
|
||||
const proxy = new Proxy({}, {});
|
||||
proxy.__proto__ = Object.create(proxy);
|
||||
expect(() => {
|
||||
proxy["foo"] = "bar";
|
||||
}).toThrowWithMessage(InternalError, "Call stack size limit exceeded");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue