ladybird/Tests/LibWeb/Text/input/HTML/StructuredClone-deep-nesting.html
aplefull 52f45aef4e LibWeb+LibJS: Don't crash when serializing deeply nested values
Deeply nested structures passed to JSON.stringify or structuredClone
would cause a lot of recursion, eventually causing a crash.

We now throw an InternalError instead, same as other browser engines.
2026-06-03 13:00:01 +01:00

19 lines
436 B
HTML

<!DOCTYPE html>
<script src="../include.js"></script>
<script>
test(() => {
const deep = [];
let current = deep;
for (let i = 0; i < 100_000; i++) {
current[0] = [];
current = current[0];
}
try {
structuredClone(deep);
println("FAILED");
} catch (e) {
println(`ERROR: ${e.name}: ${e.message}`);
}
});
</script>