LibJS: Do not revisit already visited values in update_function_name()

Fixes #3471, adds a test.
This commit is contained in:
AnotherTest 2020-09-18 18:00:57 +04:30 committed by Andreas Kling
parent e317ee7541
commit 21f513fe0f
Notes: sideshowbarker 2024-07-19 02:20:39 +09:00
2 changed files with 19 additions and 2 deletions

View file

@ -48,3 +48,10 @@ test("names of native functions", () => {
expect((console.debug.name = "warn")).toBe("warn");
expect(console.debug.name).toBe("debug");
});
test("cyclic members should not cause infinite recursion (#3471)", () => {
let a = [() => 4];
a[1] = a;
a = a;
expect(a[0].name).toBe("a");
});