mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 14:05:15 +00:00
The promise job's fulfillment / rejection handlers may push an execution context onto the VM, which will throw an internal error if our ad-hoc call stack size limit has been reached. Thus, we cannot blindly VERIFY that the result of invoking these handlers is non-abrupt. This patch will propagate any internal error forward, and retains the condition that any other error type is not thrown.
33 lines
908 B
JavaScript
33 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");
|
|
});
|