eb18edb4f5
This CL extends the kCircularStructure error message to include the constructors and keys involved in the circle: const a = {}; a.arr = []; a.arr[0] = a; JSON.stringify(a); TypeError: Converting circular structure to JSON --> starting at object with constructor 'Object' | property 'arr' -> object with constructor 'Array' --- index 0 closes the circle R=gsathya@chromium.org, yangguo@chromium.org Bug: v8:6513, v8:8696 Change-Id: I393aa3ce47d8bfd03734fccac63445006940ef7a Reviewed-on: https://chromium-review.googlesource.com/c/1433776 Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org> Commit-Queue: Simon Zünd <szuend@chromium.org> Cr-Commit-Position: refs/heads/master@{#59152}
28 lines
492 B
JavaScript
28 lines
492 B
JavaScript
// Copyright 2019 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
class Outer {
|
|
constructor(o) { this.x = o; }
|
|
}
|
|
|
|
class Inner {
|
|
constructor(o) { this.y = o; }
|
|
}
|
|
|
|
class ArrayHolder {
|
|
constructor(o) {
|
|
this.array = [];
|
|
this.array[1] = o;
|
|
}
|
|
}
|
|
|
|
const root = {};
|
|
root.first = new Outer(
|
|
new ArrayHolder(
|
|
new Inner(root)
|
|
)
|
|
);
|
|
|
|
JSON.stringify(root);
|