@@ -111,6 +111,11 @@ cls.ResourceInspector = function(network_logger)
111111
112112 var null_document_id = false ;
113113 var document_id_index = { } ;
114+ var lead = function ( str , char , len )
115+ {
116+ str = String ( str ) ;
117+ return new Array ( ( len || 8 ) - str . length + 1 ) . join ( char || "-" ) + str ;
118+ } ;
114119
115120 // filter the documents that belong in the window_id list,
116121 // set null_document_id flag,
@@ -131,8 +136,8 @@ cls.ResourceInspector = function(network_logger)
131136 document_id_index [ d . documentID ] = i ;
132137
133138 // set depth, pivot_id and same_origin
134- var p = a [ document_id_index [ d . parentDocumentID ] ] || { pivot_id : d . windowID , depth : 0 } ;
135- var id = p . pivot_id + "_" + d . documentID ;
139+ var p = a [ document_id_index [ d . parentDocumentID ] ] || { pivot_id : lead ( d . windowID ) , depth : 0 } ; ;
140+ var id = p . pivot_id + lead ( d . documentID ) ;
136141 d . depth = p . depth + 1 ;
137142 d . pivot_id = id ;
138143 d . same_origin = cls . ResourceUtil . sameOrigin ( p . url , d . url ) ;
@@ -147,9 +152,7 @@ cls.ResourceInspector = function(network_logger)
147152 }
148153
149154 return in_context ;
150- } , this ) . sort ( function ( a , b ) {
151- return a . documentID - b . documentID ;
152- } ) ;
155+ } , this ) ;
153156
154157 var unknown_document_id = false ;
155158 // filter out resources pointing to an unknown document_id,
@@ -175,7 +178,7 @@ cls.ResourceInspector = function(network_logger)
175178 r . group = this . group_order_type_index . hasOwnProperty ( r . type ) ? r . type : ctx . group_order . last . type ;
176179 r . same_origin = cls . ResourceUtil . sameOrigin ( d . url , r ) ;
177180
178- r . full_id = d . pivot_id + "_ " + this . group_order_type_index [ r . group ] + r . group + "_" + r . uid ;
181+ r . full_id = d . pivot_id + " " + lead ( this . group_order_type_index [ r . group ] , " " ) + r . group + "_" + r . uid ;
179182 r . pivot_id = d . pivot_id + "_" + r . group ;
180183 r . is_hidden = ctx . collapsed [ r . pivot_id ] == true ;
181184
@@ -194,6 +197,15 @@ cls.ResourceInspector = function(network_logger)
194197 } ) ;
195198 } ) ;
196199
200+ // sort the documents by their resources
201+ var document_id_order = { } ;
202+ ctx . resource_list . forEach ( function ( r , i ) {
203+ document_id_order [ r . document_id ] = i ;
204+ } ) ;
205+ ctx . document_list = ctx . document_list . sort ( function ( a , b ) {
206+ return document_id_order [ a . documentID ] - document_id_order [ b . documentID ] ;
207+ } ) ;
208+
197209 // request the list of documents if we have
198210 // an empty document_list
199211 // or a resource pointing to an unknown document
0 commit comments