@@ -724,16 +724,18 @@ function getCtxStyle(value, constructor, tag) {
724
724
return getPrefix ( constructor , tag , fallback ) ;
725
725
}
726
726
727
- function formatProxy ( ctx , proxy , recurseTimes ) {
727
+ function formatProxy ( ctx , target , handler , recurseTimes , showProperties = true ) {
728
728
if ( recurseTimes > ctx . depth && ctx . depth !== null ) {
729
729
return ctx . stylize ( 'Proxy [Array]' , 'special' ) ;
730
730
}
731
731
recurseTimes += 1 ;
732
732
ctx . indentationLvl += 2 ;
733
- const res = [
734
- formatValue ( ctx , proxy [ 0 ] , recurseTimes ) ,
735
- formatValue ( ctx , proxy [ 1 ] , recurseTimes ) ,
736
- ] ;
733
+ const res = showProperties ?
734
+ [
735
+ formatValue ( ctx , target , recurseTimes ) ,
736
+ formatValue ( ctx , handler , recurseTimes ) ,
737
+ ] :
738
+ [ ] ;
737
739
ctx . indentationLvl -= 2 ;
738
740
return reduceToSingleString (
739
741
ctx , res , '' , [ 'Proxy [' , ']' ] , kArrayExtrasType , recurseTimes ) ;
@@ -757,12 +759,15 @@ function formatValue(ctx, value, recurseTimes, typedArray) {
757
759
const context = value ;
758
760
// Always check for proxies to prevent side effects and to prevent triggering
759
761
// any proxy handlers.
760
- const proxy = getProxyDetails ( value , ! ! ctx . showProxy ) ;
761
- if ( proxy !== undefined ) {
762
+ const details = getProxyDetails ( value , ! ! ctx . showProxy ) ;
763
+ if ( details !== undefined ) {
762
764
if ( ctx . showProxy ) {
763
- return formatProxy ( ctx , proxy , recurseTimes ) ;
765
+ return formatProxy ( ctx , details [ 0 ] , details [ 1 ] , recurseTimes ) ;
766
+ } else if ( details === null ) {
767
+ // The proxy is revoked. Both target and handler of it are null.
768
+ return formatProxy ( ctx , details , null , recurseTimes , ctx . showProxy ) ;
764
769
}
765
- value = proxy ;
770
+ value = details ;
766
771
}
767
772
768
773
// Provide a hook for user-specified inspect functions.
@@ -778,7 +783,7 @@ function formatValue(ctx, value, recurseTimes, typedArray) {
778
783
// a counter internally.
779
784
const depth = ctx . depth === null ? null : ctx . depth - recurseTimes ;
780
785
const isCrossContext =
781
- proxy !== undefined || ! ( context instanceof Object ) ;
786
+ details !== undefined || ! ( context instanceof Object ) ;
782
787
const ret = FunctionPrototypeCall (
783
788
maybeCustom ,
784
789
context ,
0 commit comments