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
..
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-25 21:18:17 +02:00
2020-09-08 16:20:34 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-11-04 19:35:43 +01:00
2020-07-23 17:31:08 +02:00
2020-09-27 20:26:58 +02:00
2020-10-06 18:37:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-13 23:57:45 +02:00
2020-10-04 17:03:33 +02:00
2020-10-04 17:03:33 +02:00
2020-10-04 17:03:33 +02:00
2020-10-14 00:10:49 +02:00
2020-10-14 00:10:49 +02:00
2020-07-23 17:31:08 +02:00
2020-09-27 20:26:58 +02:00
2020-10-04 19:22:02 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-25 21:18:17 +02:00
2020-10-13 23:57:45 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-25 21:18:17 +02:00
2020-09-25 21:18:17 +02:00
2020-10-04 19:22:02 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-10-04 17:03:33 +02:00
2020-10-29 22:27:55 +01:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-17 23:47:07 +02:00
2020-10-17 23:23:53 +02:00
2020-10-20 08:51:41 +02:00
2020-10-20 08:51:41 +02:00
2020-10-13 23:57:45 +02:00
2020-09-08 14:15:13 +02:00
2020-09-27 20:26:58 +02:00
2020-07-23 17:31:08 +02:00
2020-10-14 00:10:49 +02:00
2020-09-27 20:26:58 +02:00
2020-10-22 17:03:40 +02:00
2020-10-22 17:03:40 +02:00
2020-09-08 13:43:03 +02:00
2020-09-08 13:43:03 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-04 17:03:33 +02:00
2020-10-04 17:03:33 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-10-16 17:06:57 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-07-15 18:24:55 +02:00
2020-10-14 00:10:49 +02:00
2020-07-23 17:31:08 +02:00
2020-11-04 19:33:49 +01:00
2020-11-04 19:33:49 +01:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-22 17:48:12 +02:00
2020-09-27 20:26:58 +02:00
2020-09-25 21:18:17 +02:00
2020-11-04 15:31:39 +01:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-11-04 14:21:06 +01:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-10-04 19:22:02 +02:00
2020-09-29 16:45:39 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-11-04 19:33:49 +01:00
2020-11-04 19:33:49 +01:00
2020-11-04 19:33:49 +01:00
2020-11-04 19:33:49 +01:00
2020-11-02 22:40:59 +01:00
2020-10-04 17:03:33 +02:00
2020-10-17 23:47:07 +02:00
2020-10-16 16:46:27 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-25 21:18:17 +02:00
2020-07-13 15:07:29 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-09-27 20:26:58 +02:00
2020-10-15 23:49:53 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-09-27 20:26:58 +02:00
2020-10-04 19:22:02 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-07-09 23:29:28 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-13 23:57:45 +02:00
2020-11-04 19:33:49 +01:00
2020-10-02 18:01:27 +02:00
2020-10-22 17:48:12 +02:00
2020-10-22 17:48:12 +02:00