@@ -56,6 +56,10 @@ cls.ResourceManagerService = function(view, network_logger)
5656
5757 this . _update = function ( msg )
5858 {
59+ // bounce if _suppress_updates
60+ if ( this . _suppress_updates )
61+ return setTimeout ( this . _update_bound , THROTTLE_DELAY ) ;
62+
5963 var ctx = { } ;
6064 // get list of window_contexts for which we saw the main_document
6165 ctx . windowList = ( this . _network_logger . get_window_contexts ( ) || [ ] ) . filter ( function ( w )
@@ -250,10 +254,9 @@ cls.ResourceManagerService = function(view, network_logger)
250254 this . _resource_request_update_bound = function ( msg )
251255 {
252256 if ( msg . type == 'resource-request-id' )
253- this . _suppressed_resource_update [ msg . resource_id ] = true ;
254- else if ( msg . type == 'resource-request-resource' )
255- delete this . _suppressed_resource_update [ msg . resource_id ] ;
256-
257+ this . _suppress_updates = true ;
258+ else
259+ this . _suppress_updates = false ;
257260 } . bind ( this ) ;
258261
259262 this . _init = function ( )
@@ -273,6 +276,7 @@ cls.ResourceManagerService = function(view, network_logger)
273276
274277 messages . addListener ( 'resource-request-id' , this . _resource_request_update_bound ) ;
275278 messages . addListener ( 'resource-request-resource' , this . _resource_request_update_bound ) ;
279+ messages . addListener ( 'resource-request-fallback' , this . _resource_request_update_bound ) ;
276280
277281 this . _network_logger . addListener ( "resource-update" , this . _update_bound ) ;
278282 this . _network_logger . addListener ( "window-context-added" , this . _update_bound ) ;
@@ -291,7 +295,7 @@ cls.ResourceManagerService = function(view, network_logger)
291295 this . _collapsedHash = { } ;
292296 this . _documentResources = { } ;
293297
294- this . _suppressed_resource_update = { } ;
298+ this . _suppress_updates = false ;
295299 this . _view . update ( ) ;
296300 } ;
297301
@@ -322,6 +326,7 @@ cls.ResourceManagerService = function(view, network_logger)
322326
323327 this . request_resource = function ( url , callback , data )
324328 {
329+ this . _suppress_updates = true ;
325330 new cls . ResourceRequest ( url , callback , data ) ;
326331 }
327332
@@ -358,6 +363,9 @@ cls.ResourceRequest = function(url, callback, data)
358363
359364 this . _fallback = function ( )
360365 {
366+ // broadcast that we fellback
367+ window . messages . post ( 'resource-request-fallback' , { resource_id : this . resource_id } ) ;
368+
361369 window . open ( this . url ) ;
362370 }
363371
0 commit comments