summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/console.ts9
-rw-r--r--js/console_test.ts1
2 files changed, 7 insertions, 3 deletions
diff --git a/js/console.ts b/js/console.ts
index 3d2d65909..bb597d9f2 100644
--- a/js/console.ts
+++ b/js/console.ts
@@ -63,9 +63,12 @@ function createIterableString(
ctx.add(value);
const entries: string[] = [];
- for (const el of value) {
- entries.push(config.entryHandler(el, ctx, level + 1, maxLevel));
- }
+ // In cases e.g. Uint8Array.prototype
+ try {
+ for (const el of value) {
+ entries.push(config.entryHandler(el, ctx, level + 1, maxLevel));
+ }
+ } catch (e) {}
ctx.delete(value);
const iPrefix = `${config.displayName ? config.displayName + " " : ""}`;
const iContent = entries.length === 0 ? "" : ` ${entries.join(", ")} `;
diff --git a/js/console_test.ts b/js/console_test.ts
index eb53ebb76..578fb02b4 100644
--- a/js/console_test.ts
+++ b/js/console_test.ts
@@ -103,6 +103,7 @@ test(function consoleTestStringifyCircular() {
"[AsyncGeneratorFunction: agf]"
);
assertEqual(stringify(new Uint8Array([1, 2, 3])), "Uint8Array [ 1, 2, 3 ]");
+ assertEqual(stringify(Uint8Array.prototype), "TypedArray []");
assertEqual(
stringify({ a: { b: { c: { d: new Set([1]) } } } }),
"{ a: { b: { c: { d: [Set] } } } }"