File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -398,6 +398,22 @@ export function hasTaintedMethod (scope, shouldStackCheck = false) {
398
398
return false
399
399
}
400
400
401
+ /**
402
+ * @param {*[] } argsArray
403
+ * @returns {string | undefined }
404
+ */
405
+ function debugSerialize ( argsArray ) {
406
+ const serializedArgs = argsArray . map ( ( arg ) => {
407
+ try {
408
+ return JSON . stringify ( arg )
409
+ } catch ( e ) {
410
+ // Sometimes this happens when we can't serialize an object to string but we still wish to log it and make other args readable
411
+ return '[unserializable]'
412
+ }
413
+ } )
414
+ return JSON . stringify ( serializedArgs )
415
+ }
416
+
401
417
/**
402
418
* @template {object} P
403
419
* @typedef {object } ProxyObject<P>
@@ -440,7 +456,7 @@ export class DDGProxy {
440
456
kind : this . property ,
441
457
documentUrl : document . location . href ,
442
458
stack : getStack ( ) ,
443
- args : JSON . stringify ( args [ 2 ] )
459
+ args : debugSerialize ( args [ 2 ] )
444
460
} )
445
461
}
446
462
// The normal return value
You can’t perform that action at this time.
0 commit comments