1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 14:15:07 +00:00
serenity/Libraries/LibJS/Tests/builtins
Linus Groh 0603402c80 LibJS: Handle circular references in Array.prototype.join()
This fixes Array.prototype.{join,toString}() crashing with arrays
containing themselves, i.e. circular references.

The spec is suspiciously silent about this, and indeed engine262, a
"100% spec compliant" ECMA-262 implementation, can't handle these cases.
I had a look at some major engines instead and they all seem to keep
track or check for circular references and return an empty string for
already seen objects.

- SpiderMonkey: "AutoCycleDetector detector(cx, obj)"
- V8: "CycleProtectedArrayJoin<JSArray>(...)"
- JavaScriptCore: "StringRecursionChecker checker(globalObject, thisObject)"
- ChakraCore: "scriptContext->CheckObject(thisArg)"

To keep things simple & consistent this uses the same pattern as
JSONObject, MarkupGenerator and js: simply putting each seen object in a
HashTable<Object*>.

Fixes #3929.
2020-11-04 19:35:43 +01:00
..
Array LibJS: Handle circular references in Array.prototype.join() 2020-11-04 19:35:43 +01:00
BigInt Everywhere: Fix typos 2020-10-02 16:03:17 +02:00
Boolean LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Date LibJS: Add some more tests, mostly around leap years 2020-08-26 08:52:07 +02:00
Error LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Function LibJS: Tweak generated source in 'new Function()' to match ES 2015 spec 2020-10-29 22:27:55 +01:00
functions LibJS: Split isNaN tests into multiple sections 2020-07-06 23:40:35 +02:00
Infinity LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
JSON LibJS: Handle getter exception in JSONObject::serialize_json_property() 2020-09-19 14:17:22 +02:00
Math JS Tests: Disable the one failing test when running test-js in Serenity 2020-08-25 21:23:10 +02:00
NaN LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Number LibJS: Add Number.prototype.toString 2020-07-15 18:24:55 +02:00
Object LibJS: Don't change offset when reconfiguring property in unique shape 2020-10-10 23:25:00 +02:00
Proxy LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Reflect LibJS: Object.preventExtensions should allow property modfication 2020-07-07 10:47:10 +02:00
RegExp LibJS: Implement RegExp.prototype.toString() as standalone function 2020-11-04 19:33:49 +01:00
String LibJS: Implement String.prototype.charCodeAt 2020-07-22 15:48:01 +02:00
Symbol LibJS: Allow conversion from Symbol to String via explicit String() call 2020-08-22 10:52:40 +02:00