Skip to content

Commit ce8aea7

Browse files
author
p01
committed
Review fixes
1 parent 9259710 commit ce8aea7

File tree

3 files changed

+39
-34
lines changed

3 files changed

+39
-34
lines changed

src/resource-manager/resource_detail_view.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ cls.ResourceDetailView.create_ui_widgets = function()
226226
});
227227

228228
var text_search = window.views.resource_detail_view.text_search = new TextSearch();
229-
var TEXT_RESOURCE_DETAIL_CONTAINER_CLASSNAMES = ["markup", "css", "script", "text"].map( function(v) {
229+
var TEXT_RESOURCE_DETAIL_CONTAINER_CLASSNAMES = ["markup", "css", "script", "text"].map(function(v) {
230230
return ".resource-detail-" + v + "-container";
231231
});
232232

src/resource-manager/resource_service.js

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ cls.ResourceInspector = function(network_logger)
5555
{
5656
this.group_order = this.tree_view.get_group_order();
5757
this.group_order_type_index = {};
58-
this.group_order.forEach( function(g, i) {
58+
this.group_order.forEach(function(g, i) {
5959
this.group_order_type_index[g.type] = i;
6060
}, this);
6161
}
@@ -92,8 +92,8 @@ cls.ResourceInspector = function(network_logger)
9292
if (ctx.window_list.length)
9393
{
9494
// get all the (non-suppressed) resources with content
95-
ctx.resource_list = (this._network_logger.get_resources() || []).filter(function(v) {
96-
return !this._suppress_uids.hasOwnProperty(v.uid) && v.responsecode != 204;
95+
ctx.resource_list = (this._network_logger.get_resources() || []).filter(function(resource) {
96+
return !this._suppress_uids.hasOwnProperty(resource.uid) && resource.responsecode != 204;
9797
}, this);
9898

9999
ctx.selected_resource_uid = this._selected_resource_uid;
@@ -124,34 +124,39 @@ cls.ResourceInspector = function(network_logger)
124124
// set null_document_id flag,
125125
// augment the document objects,
126126
// set the default collapsed flags
127-
ctx.document_list = this._document_list.filter(function(d, i, a) {
128-
var in_context = window_id_index.hasOwnProperty(d.windowID);
127+
ctx.document_list = this._document_list.filter(function(document, document_index, document_list) {
128+
var in_context = window_id_index.hasOwnProperty(document.windowID);
129129

130130
if (in_context)
131131
{
132-
if (!null_document_id && !d.documentID)
132+
if (!null_document_id && !document.documentID)
133133
null_document_id = true;
134134

135-
if (d.resourceID != null)
136-
ctx.document_resource_hash[d.resourceID] = d.documentID;
135+
if (document.resourceID != null)
136+
ctx.document_resource_hash[document.resourceID] = document.documentID;
137137

138138
// populate document_id_index
139-
document_id_index[d.documentID] = i;
139+
document_id_index[document.documentID] = document_index;
140140

141141
// set depth, pivot_id and same_origin
142-
var p = a[document_id_index[d.parentDocumentID]];
143-
if (!p)
144-
p = {pivot_id: ctx.window_list[window_id_index[d.windowID]].pivot_id, depth: 0};
145-
var id = p.pivot_id + lead(d.documentID);
146-
d.depth = p.depth + 1;
147-
d.pivot_id = id;
148-
d.same_origin = cls.ResourceUtil.sameOrigin(p.url, d.url);
142+
var parent_document = document_list[document_id_index[document.parentDocumentID]];
143+
if (!parent_document)
144+
{
145+
parent_document = {
146+
"pivot_id": ctx.window_list[window_id_index[document.windowID]].pivot_id,
147+
"depth": 0
148+
};
149+
}
150+
var id = parent_document.pivot_id + lead(document.documentID);
151+
document.depth = parent_document.depth + 1;
152+
document.pivot_id = id;
153+
document.same_origin = cls.ResourceUtil.sameOrigin(parent_document.url, document.url);
149154

150155
// set the default collapsed flag
151156
var hash = this._collapsed_hash;
152157
if (!hash.hasOwnProperty(id))
153158
{
154-
hash[id] = d.depth > 1;
159+
hash[id] = document.depth > 1;
155160
ctx.group_order.forEach(function(g) { hash[id + "_" + g.type] = true; });
156161
}
157162
}
@@ -167,25 +172,25 @@ cls.ResourceInspector = function(network_logger)
167172
// same_origin flag to each resource,
168173
// full_id ( pivot_id + group + uid ),
169174
// pivot_id
170-
ctx.resource_list = ctx.resource_list.filter(function(r) {
175+
ctx.resource_list = ctx.resource_list.filter(function(resource) {
171176
// check if this is the top resource of a document
172-
var document_id = ctx.document_resource_hash[r.resource_id];
173-
if (document_id != null && document_id != r.document_id)
174-
r.document_id = document_id;
177+
var document_id = ctx.document_resource_hash[resource.resource_id];
178+
if (document_id != null && document_id != resource.document_id)
179+
resource.document_id = document_id;
175180

176-
var d = this._document_list[document_id_index[r.document_id]];
177-
if (!d)
181+
var document = this._document_list[document_id_index[resource.document_id]];
182+
if (!document)
178183
{
179184
unknown_document_id = true;
180185
return false;
181186
}
182187

183-
r.group = this.group_order_type_index.hasOwnProperty(r.type) ? r.type : ctx.group_order.last.type;
184-
r.same_origin = cls.ResourceUtil.sameOrigin(d.url, r);
188+
resource.group = this.group_order_type_index.hasOwnProperty(resource.type) ? resource.type : ctx.group_order.last.type;
189+
resource.same_origin = cls.ResourceUtil.sameOrigin(document.url, resource);
185190

186-
r.full_id = d.pivot_id + " " + lead(this.group_order_type_index[r.group], " ") + r.group + "_" + r.uid;
187-
r.pivot_id = d.pivot_id + "_" + r.group;
188-
r.is_hidden = ctx.collapsed[r.pivot_id] == true;
191+
resource.full_id = document.pivot_id + " " + lead(this.group_order_type_index[resource.group], " ") + "_" + resource.uid;
192+
resource.pivot_id = document.pivot_id + "_" + resource.group;
193+
resource.is_hidden = ctx.collapsed[resource.pivot_id] == true;
189194

190195
return true;
191196
}, this);
@@ -196,9 +201,9 @@ cls.ResourceInspector = function(network_logger)
196201
});
197202

198203
// filter the list of window. Purge the ones with no documents
199-
ctx.window_list = ctx.window_list.filter(function(v) {
200-
return ctx.document_list.some(function(w) {
201-
return v.id == w.windowID;
204+
ctx.window_list = ctx.window_list.filter(function(window) {
205+
return ctx.document_list.some(function(document) {
206+
return window.id == document.windowID;
202207
});
203208
});
204209

@@ -293,8 +298,7 @@ cls.ResourceInspector = function(network_logger)
293298
{
294299
e.addClass(HIGHLIGHT_CLASSNAME);
295300

296-
if (window.Tooltips)
297-
window.Tooltips.hide_tooltip();
301+
Tooltips.hide_tooltip();
298302

299303
// scroll into view
300304
var container = this.tree_view.get_container().firstChild;

src/resource-manager/resource_style.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ a.resource-detail-link:hover
265265
height: 100%;
266266
border: 0;
267267
font-size: 64px;
268+
/* The @font-face declaration of "the font" is created by the resource_detail.font template */
268269
font-family: "the font";
269270
box-sizing: border-box;
270271
white-space: pre;

0 commit comments

Comments
 (0)