Skip to content

Commit 06774a3

Browse files
author
Daniel Herzog
committed
Moved check_to_get_body to Entry.
1 parent 1a57671 commit 06774a3

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

src/network/network_service.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ cls.NetworkLoggerService = function(view)
221221
this._res_service.requestSetResponseMode(cls.TagManager.IGNORE_RESPONSE, resparg);
222222
}.bind(this);
223223

224-
this.get_body = function(itemid, update_callback)
224+
this.get_body = function(itemid)
225225
{
226226
if (!this._current_context)
227227
return;
@@ -230,11 +230,11 @@ cls.NetworkLoggerService = function(view)
230230
entry.called_get_body = true;
231231
var contentmode = cls.ResourceUtil.mime_to_content_mode(entry.mime);
232232
var typecode = {datauri: 3, string: 1}[contentmode] || 1;
233-
var tag = window.tagManager.set_callback(this, this._handle_get_resource, [update_callback, entry]);
233+
var tag = window.tagManager.set_callback(this, this._handle_get_resource, [entry]);
234234
this._res_service.requestGetResource(tag, [entry.resource_id, [typecode, 1]]);
235235
};
236236

237-
this._handle_get_resource = function(status, data, update_callback, entry)
237+
this._handle_get_resource = function(status, data, entry)
238238
{
239239
if (!this._current_context)
240240
return;
@@ -250,8 +250,8 @@ cls.NetworkLoggerService = function(view)
250250
this._current_context.update("responsebody", msg);
251251
}
252252
// Update the view. This is only needed when the generic updating per event is paused.
253-
if (this.is_paused && update_callback)
254-
update_callback();
253+
if (this.is_paused && window.views && window.views.network_logger)
254+
window.views.network_logger.update();
255255

256256
};
257257

@@ -961,6 +961,22 @@ cls.NetworkLoggerEntryPrototype = function()
961961
this.events.push(evt);
962962
};
963963

964+
this.check_to_get_body = function(service)
965+
{
966+
// Decide if body should be fetched, for when content-tracking is off or it's a cached request.
967+
if (
968+
this.is_finished &&
969+
!this.called_get_body &&
970+
(!this.current_response || !this.current_response.responsebody) &&
971+
// When we have a response, but didn't see responsefinished, it means there's really no
972+
// responsebody. Don't attempt to fetch it.
973+
(!this.current_response || this.current_response.saw_responsefinished)
974+
)
975+
{
976+
service.get_body(this.id);
977+
}
978+
};
979+
964980
this.__defineGetter__("duration", function()
965981
{
966982
return (this.events.length && this.endtime - this.starttime) || 0;

src/network/network_view.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,7 @@ cls.NetworkLogView = function(id, name, container_class, html, default_handler)
185185
var entry = ctx.get_entry_from_filtered(this._selected);
186186
if (entry)
187187
{
188-
// Decide to try to fetch the body, for when content-tracking is off or it's a cached request.
189-
if (
190-
entry.is_finished &&
191-
!entry.called_get_body &&
192-
(!entry.current_response || !entry.current_response.responsebody) &&
193-
// When we have a response, but didn't see responsefinished, it means there's really no
194-
// responsebody. Don't attempt to fetch it.
195-
(!entry.current_response || entry.current_response.saw_responsefinished)
196-
)
197-
{
198-
this._service.get_body(entry.id, this.update_bound);
199-
}
188+
entry.check_to_get_body(this._service);
200189
template = [template, this._render_details_view(entry)];
201190
}
202191
}

0 commit comments

Comments
 (0)