@@ -39,9 +39,8 @@ var BUFFER_FULL_MESSAGE_INDEX = 0;
3939var NATIVE_PROPERTY_MESSAGE_INDEX = 1 ;
4040var GETTER_MESSAGE_INDEX = 2 ;
4141var ARG_LOCAL_LIMIT_MESSAGE_INDEX = 3 ;
42- var OBJECT_LIMIT_MESSAGE_INDEX = 4 ;
43- var STRING_LIMIT_MESSAGE_INDEX = 5 ;
44- var DATA_LIMIT_MESSAGE_INDEX = 6 ;
42+ var STRING_LIMIT_MESSAGE_INDEX = 4 ;
43+ var DATA_LIMIT_MESSAGE_INDEX = 5 ;
4544
4645var MESSAGE_TABLE = [ ] ;
4746MESSAGE_TABLE [ BUFFER_FULL_MESSAGE_INDEX ] =
@@ -58,11 +57,6 @@ MESSAGE_TABLE[ARG_LOCAL_LIMIT_MESSAGE_INDEX] =
5857 'Locals and arguments are only displayed for the ' +
5958 'top `config.capture.maxExpandFrames` stack frames.' ,
6059 true ) } ;
61- MESSAGE_TABLE [ OBJECT_LIMIT_MESSAGE_INDEX ] =
62- { status : new StatusMessage ( StatusMessage . VARIABLE_VALUE ,
63- 'Only first `config.capture.maxProperties` elements' +
64- ' were captured.' ,
65- false ) } ;
6660MESSAGE_TABLE [ STRING_LIMIT_MESSAGE_INDEX ] =
6761 { status : new StatusMessage ( StatusMessage . VARIABLE_VALUE ,
6862 'Only first `config.capture.maxStringLength` chars' +
@@ -474,15 +468,8 @@ StateResolver.prototype.resolveVariable_ = function(name, value) {
474468
475469 } else if ( value . isFunction ( ) ) {
476470 data . value = 'function ' + this . resolveFunctionName_ ( value ) + '()' ;
477-
478471 } else if ( value . isObject ( ) ) {
479472 data . varTableIndex = this . getVariableIndex_ ( value ) ;
480- var maxProps = this . config_ . capture . maxProperties ;
481- var numKeys = Object . keys ( value . value ( ) ) . length ;
482-
483- if ( maxProps && maxProps < numKeys ) {
484- data . status = MESSAGE_TABLE [ OBJECT_LIMIT_MESSAGE_INDEX ] . status ;
485- }
486473 } else {
487474 // PropertyMirror, InternalPropertyMirror, FrameMirror, ScriptMirror
488475 data . value = 'unknown mirror type' ;
@@ -538,18 +525,22 @@ StateResolver.prototype.resolveMirrorSlow_ = function(mirror) {
538525
539526 var keys = Object . keys ( mirror . value ( ) ) ;
540527 var maxProps = that . config_ . capture . maxProperties ;
541-
542- if ( maxProps ) {
528+ var truncate = maxProps && keys . length > maxProps ;
529+ if ( truncate ) {
543530 keys = keys . slice ( 0 , maxProps ) ;
544531 }
545532 var members = keys . map ( function ( prop ) {
546533 return that . resolveMirrorProperty_ ( mirror . property ( prop ) ) ;
547534 } ) ;
535+ if ( truncate ) {
536+ members . push ( { name : 'Only first `config.capture.maxProperties` ' +
537+ 'properties were captured' } ) ;
538+ }
548539
549540 var mirrorVal = mirror . value ( ) ;
550541 var len = mirrorVal && mirrorVal . length ;
551542 return {
552- value : mirror . toText ( ) +
543+ value : mirror . toText ( ) +
553544 ( ( typeof len === 'undefined' ) ? '' : ' of length ' + len ) ,
554545 members : members
555546 } ;
@@ -559,20 +550,22 @@ StateResolver.prototype.resolveMirrorSlow_ = function(mirror) {
559550//
560551// See https://github.com/iojs/io.js/issues/1190.
561552StateResolver . prototype . resolveMirrorFast_ = function ( mirror ) {
562- var members = this . getMirrorProperties_ ( mirror ) . map (
563- this . resolveMirrorProperty_ . bind ( this ) ) ;
553+ var properties = mirror . properties ( ) ;
554+ var maxProps = this . config_ . capture . maxProperties ;
555+ var truncate = maxProps && properties . length > maxProps ;
556+ if ( truncate ) {
557+ properties = properties . slice ( 0 , maxProps ) ;
558+ }
559+ var members = properties . map ( this . resolveMirrorProperty_ . bind ( this ) ) ;
560+ if ( truncate ) {
561+ members . push ( { name : 'Only first maxProperties properties were captured' } ) ;
562+ }
564563 return {
565564 value : mirror . toText ( ) ,
566565 members : members
567566 } ;
568567} ;
569568
570- StateResolver . prototype . getMirrorProperties_ = function ( mirror ) {
571- var numProperties = this . config_ . capture . maxProperties ;
572- var properties = mirror . properties ( ) ;
573- return numProperties ? properties . slice ( 0 , numProperties ) : properties ;
574- } ;
575-
576569StateResolver . prototype . resolveMirrorProperty_ = function ( property ) {
577570 var name = String ( property . name ( ) ) ;
578571 // Array length must be special cased as it is a native property that
0 commit comments