Skip to content

Commit 726a165

Browse files
author
p01
committed
Broadcast messages when cls.ResourceRequest gets the resource_id and responsebody
1 parent f11ae32 commit 726a165

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/resource-manager/resource_service.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ cls.ResourceManagerService = function(view, network_logger)
281281

282282
var messages = window.messages;
283283
messages.addListener('debug-context-selected', this._on_debug_context_selected_bound);
284+
285+
messages.addListener('resource-request-id', this._resource_request_update_bound);
286+
messages.addListener('resource-request-resource', this._resource_request_update_bound);
287+
284288
this._network_logger.addListener("resource-update", this._update_bound);
285289
this._network_logger.addListener("window-context-added", this._update_bound);
286290
this._network_logger.addListener("window-context-removed", this._update_bound);
@@ -372,6 +376,10 @@ cls.ResourceRequest = function(url, callback, data)
372376
// resource_id -> getResource => _on_request_get_resource
373377
const RESOURCE_ID = 0;
374378
this.resource_id = message[RESOURCE_ID];
379+
380+
// broadcast that we are working on the resource this.resource_id
381+
window.messages.post('resource-request-id', {resource_id: this.resource_id});
382+
375383
this._request_get_resource();
376384
}
377385
else
@@ -405,6 +413,8 @@ cls.ResourceRequest = function(url, callback, data)
405413
this.requests_responses = [{responsebody:resourceData}];
406414
this.resourceInfo = new cls.ResourceInfo(this);
407415

416+
// broadcast that we got payload of the resource
417+
window.messages.post('resource-request-resource', {resource_id: this.resource_id});
408418

409419
// aaaand callback
410420
this._callback(this.resourceInfo, this._calback_data);

0 commit comments

Comments
 (0)