Files
ladybird/Tests/LibJS/Runtime/runtime-error-call-stack-size.js
2026-01-22 07:46:48 -05:00

34 lines
908 B
JavaScript

test("infinite recursion", () => {
function infiniteRecursion() {
infiniteRecursion();
}
try {
infiniteRecursion();
} catch (e) {
expect(e).toBeInstanceOf(InternalError);
expect(e.name).toBe("InternalError");
expect(e.message).toBe("Call stack size limit exceeded");
}
expect(() => {
JSON.stringify({}, () => ({ foo: "bar" }));
}).toThrowWithMessage(InternalError, "Call stack size limit exceeded");
expect(() => {
new Proxy({}, { get: (_, __, p) => p.foo }).foo;
}).toThrowWithMessage(InternalError, "Call stack size limit exceeded");
expect(() => {
function outer() {
async function inner() {
await outer;
}
inner();
outer();
}
outer();
}).toThrowWithMessage(InternalError, "Call stack size limit exceeded");
});