Skip to content

Commit 240875e

Browse files
author
Daniel Herzog
committed
Refactoring some property names for more clearness
1 parent 6c761c5 commit 240875e

File tree

4 files changed

+19
-23
lines changed

4 files changed

+19
-23
lines changed

src/network/network_details_templates.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ templates.network_log_details = function(entry, left_val)
3030

3131
templates.network_log_detail = function(entry)
3232
{
33-
var responsecode = entry.responsecode;
33+
var responsecode = entry.last_responsecode;
3434
if (responsecode && responsecode in cls.ResourceUtil.http_status_codes)
3535
responsecode = responsecode + " " + cls.ResourceUtil.http_status_codes[responsecode];
3636

@@ -43,15 +43,15 @@ templates.network_log_detail = function(entry)
4343
],
4444
["tr",
4545
["th", ui_strings.S_HTTP_LABEL_METHOD + ":"],
46-
["td", entry.touched_network ? entry.method : ui_strings.S_RESOURCE_ALL_NOT_APPLICABLE],
47-
"data-spec", "http#" + entry.method
46+
["td", entry.touched_network ? entry.last_method : ui_strings.S_RESOURCE_ALL_NOT_APPLICABLE],
47+
"data-spec", "http#" + entry.last_method
4848
],
4949
["tr",
5050
["th", ui_strings.M_NETWORK_REQUEST_DETAIL_STATUS + ":"],
5151
["td",
5252
entry.touched_network && responsecode ? String(responsecode) : ui_strings.S_RESOURCE_ALL_NOT_APPLICABLE
5353
],
54-
"data-spec", "http#" + entry.responsecode
54+
"data-spec", "http#" + entry.last_responsecode
5555
]
5656
],
5757
entry.touched_network ? [] : templates.did_not_touch_network(entry),

src/network/network_service.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,8 @@ cls.NetworkLoggerEntry = function(id, resource_id, document_id, context_starttim
504504
this.starttime_relative = null;
505505
this.endtime = null;
506506
this.requests_responses = [];
507-
this.responsecode = null;
508-
this.status = null;
509-
this.method = null;
507+
this.last_responsecode = null;
508+
this.last_method = null;
510509
this.is_unloaded = false;
511510
this.is_finished = false;
512511
this.events = [];
@@ -728,7 +727,7 @@ cls.NetworkLoggerEntryPrototype = function()
728727

729728
this._update_event_request = function(event)
730729
{
731-
this.method = event.method;
730+
this.last_method = event.method;
732731
this._current_request = new cls.NetworkLoggerRequest(this);
733732
this.requests_responses.push(this._current_request);
734733
this._current_request._update_event_request(event);
@@ -763,11 +762,8 @@ cls.NetworkLoggerEntryPrototype = function()
763762

764763
this._update_event_response = function(event)
765764
{
766-
// On every response, entry.responsecode is overwritten to reflect what
767-
// the "final" responsecode for the request was.
768-
// Each individual response is also stored as a NetworkLoggerResponse.
769-
this.responsecode = event.responseCode;
770-
this.had_error_response = /^[45]/.test(this.responsecode);
765+
this.last_responsecode = event.responseCode;
766+
this.error_in_last_response = /^[45]/.test(this.responsecode);
771767
this._current_response = new cls.NetworkLoggerResponse(this);
772768
this.requests_responses.push(this._current_response);
773769
this._current_response._update_event_response(event);

src/network/network_templates.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ templates.network_viewmode_graphs = function(ctx, entries, selected, width)
173173

174174
templates.network_log_url_list_entry = function(selected, entry)
175175
{
176-
var had_error_response = entry.had_error_response;
176+
var error_in_last_response = entry.error_in_last_response;
177177
var not_requested = !entry.touched_network;
178178

179179
return ["li",
@@ -186,7 +186,7 @@ templates.network_log_url_list_entry = function(selected, entry)
186186
"handler", "select-network-request",
187187
"data-object-id", String(entry.id),
188188
"class", (selected === entry.id ? "selected" : "") +
189-
(had_error_response ? " " + ERROR_RESPONSE : "") +
189+
(error_in_last_response ? " " + ERROR_RESPONSE : "") +
190190
(not_requested ? " " + NOT_REQUESTED : "")
191191
];
192192
};
@@ -216,10 +216,10 @@ templates.network_log_url_tooltip = function(entry)
216216
context_string = ui_strings.S_HTTP_UNREFERENCED;
217217
context_type = UNREFERENCED;
218218
}
219-
else if (entry.had_error_response)
219+
else if (entry.error_in_last_response)
220220
{
221-
context_string = entry.responsecode +
222-
" (" + HTTP_STATUS_CODES[entry.responsecode] + ")";
221+
context_string = entry.last_responsecode +
222+
" (" + HTTP_STATUS_CODES[entry.last_responsecode] + ")";
223223
context_type = ERROR_RESPONSE;
224224
}
225225
else if (!entry.touched_network)

src/network/network_view.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,20 +229,20 @@ cls.NetworkLogView = function(id, name, container_class, html, default_handler)
229229
columns: {
230230
method: {
231231
label: ui_strings.S_HTTP_LABEL_METHOD,
232-
getter: function(entry) { return entry.method || ""; }
232+
getter: function(entry) { return entry.last_method || ""; }
233233
},
234234
responsecode: {
235235
label: ui_strings.S_HTTP_LABEL_RESPONSECODE,
236236
headertooltip: ui_strings.S_HTTP_TOOLTIP_RESPONSECODE,
237237
renderer: function(entry) {
238-
return (entry.responsecode && String(entry.responsecode)) || "";
238+
return (entry.last_responsecode && String(entry.last_responsecode)) || "";
239239
},
240240
title_getter: function(entry, renderer) {
241-
if (cls.ResourceUtil.http_status_codes[entry.responsecode])
242-
return String(cls.ResourceUtil.http_status_codes[entry.responsecode]);
241+
if (cls.ResourceUtil.http_status_codes[entry.last_responsecode])
242+
return String(cls.ResourceUtil.http_status_codes[entry.last_responsecode]);
243243
return renderer(entry);
244244
},
245-
getter: function(entry) { return entry.responsecode || 0; }
245+
getter: function(entry) { return entry.last_responsecode || 0; }
246246
},
247247
mime: {
248248
label: ui_strings.S_RESOURCE_ALL_TABLE_COLUMN_MIME,

0 commit comments

Comments
 (0)