| Index: src/d8.js
|
| diff --git a/src/d8.js b/src/d8.js
|
| index 8d55c788e2b42fa0d591ed146316c2c29dd9f365..c52d33a5f41f09ca33f048d32566519a363755b6 100644
|
| --- a/src/d8.js
|
| +++ b/src/d8.js
|
| @@ -13,6 +13,9 @@ function Stringify(x, depth) {
|
| depth = stringifyDepthLimit;
|
| else if (depth === 0)
|
| return "*";
|
| + if (IS_PROXY(x)) {
|
| + return StringifyProxy(x, depth);
|
| + }
|
| switch (typeof x) {
|
| case "undefined":
|
| return "undefined";
|
| @@ -63,3 +66,22 @@ function Stringify(x, depth) {
|
| return "[crazy non-standard value]";
|
| }
|
| }
|
| +
|
| +function StringifyProxy(proxy, depth) {
|
| + var proxy_type = typeof proxy;
|
| + return '[' + proxy_type + ' Proxy {' +
|
| + 'target: ' +
|
| + StringifyProxyInternal(%JSProxyGetTarget(proxy), depth) + ', ' +
|
| + 'handler: '+
|
| + StringifyProxyInternal(%JSProxyGetHandler(proxy), depth) +
|
| + '}]';
|
| +}
|
| +
|
| +function StringifyProxyInternal(object, depth) {
|
| + // Special case to handle proxy __proto__ recursions on target or handler.
|
| + try {
|
| + return Stringify(object, depth-1);
|
| + } catch(RangeError) {
|
| + return '{*}'
|
| + }
|
| +}
|
|
|