OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> | 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> |
4 * Copyright (C) 2011 Google Inc. All rights reserved. | 4 * Copyright (C) 2011 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2298 this._refreshTimeCell(); | 2298 this._refreshTimeCell(); |
2299 | 2299 |
2300 var responseHeaderColumns = WebInspector.NetworkLogView._responseHeaderC
olumns; | 2300 var responseHeaderColumns = WebInspector.NetworkLogView._responseHeaderC
olumns; |
2301 for (var i = 0; i < responseHeaderColumns.length; ++i) | 2301 for (var i = 0; i < responseHeaderColumns.length; ++i) |
2302 this._refreshResponseHeaderCell(responseHeaderColumns[i]); | 2302 this._refreshResponseHeaderCell(responseHeaderColumns[i]); |
2303 | 2303 |
2304 if (this._request.cached) | 2304 if (this._request.cached) |
2305 this._timelineCell.classList.add("resource-cached"); | 2305 this._timelineCell.classList.add("resource-cached"); |
2306 | 2306 |
2307 this._element.classList.add("network-item"); | 2307 this._element.classList.add("network-item"); |
2308 this._element.enableStyleClass("network-error-row", this._request.failed
|| (this._request.statusCode >= 400)); | 2308 this._element.enableStyleClass("network-error-row", this._isFailed()); |
2309 this._updateElementStyleClasses(this._element); | 2309 this._updateElementStyleClasses(this._element); |
2310 }, | 2310 }, |
2311 | 2311 |
2312 /** | 2312 /** |
| 2313 * @return {boolean} |
| 2314 */ |
| 2315 _isFailed: function() |
| 2316 { |
| 2317 return !!this._request.failed || (this._request.statusCode >= 400); |
| 2318 }, |
| 2319 |
| 2320 /** |
2313 * @param {!Element} element | 2321 * @param {!Element} element |
2314 */ | 2322 */ |
2315 _updateElementStyleClasses: function(element) | 2323 _updateElementStyleClasses: function(element) |
2316 { | 2324 { |
2317 var typeClassName = "network-type-" + this._request.type.name(); | 2325 var typeClassName = "network-type-" + this._request.type.name(); |
2318 if (!element.classList.contains(typeClassName)) { | 2326 if (!element.classList.contains(typeClassName)) { |
2319 element.removeMatchingStyleClasses("network-type-\\w+"); | 2327 element.removeMatchingStyleClasses("network-type-\\w+"); |
2320 element.classList.add(typeClassName); | 2328 element.classList.add(typeClassName); |
2321 } | 2329 } |
2322 }, | 2330 }, |
(...skipping 28 matching lines...) Expand all Loading... |
2351 }, | 2359 }, |
2352 | 2360 |
2353 _refreshMethodCell: function() | 2361 _refreshMethodCell: function() |
2354 { | 2362 { |
2355 this._methodCell.setTextAndTitle(this._request.requestMethod); | 2363 this._methodCell.setTextAndTitle(this._request.requestMethod); |
2356 }, | 2364 }, |
2357 | 2365 |
2358 _refreshStatusCell: function() | 2366 _refreshStatusCell: function() |
2359 { | 2367 { |
2360 this._statusCell.removeChildren(); | 2368 this._statusCell.removeChildren(); |
| 2369 this._statusCell.enableStyleClass("network-dim-cell", !this._isFailed()
&& (this._request.cached || !this._request.statusCode)); |
2361 | 2370 |
2362 if (this._request.failed) { | 2371 if (this._request.failed && !this._request.canceled) { |
2363 var failText = this._request.canceled ? WebInspector.UIString("(canc
eled)") : WebInspector.UIString("(failed)"); | 2372 var failText = WebInspector.UIString("(failed)"); |
2364 if (this._request.localizedFailDescription) { | 2373 if (this._request.localizedFailDescription) { |
2365 this._statusCell.appendChild(document.createTextNode(failText)); | 2374 this._statusCell.appendChild(document.createTextNode(failText)); |
2366 this._appendSubtitle(this._statusCell, this._request.localizedFa
ilDescription); | 2375 this._appendSubtitle(this._statusCell, this._request.localizedFa
ilDescription); |
2367 this._statusCell.title = failText + " " + this._request.localize
dFailDescription; | 2376 this._statusCell.title = failText + " " + this._request.localize
dFailDescription; |
2368 } else | 2377 } else |
2369 this._statusCell.setTextAndTitle(failText); | 2378 this._statusCell.setTextAndTitle(failText); |
2370 this._statusCell.classList.add("network-dim-cell"); | 2379 } else if (this._request.statusCode) { |
2371 return; | |
2372 } | |
2373 | |
2374 this._statusCell.classList.remove("network-dim-cell"); | |
2375 | |
2376 if (this._request.statusCode) { | |
2377 this._statusCell.appendChild(document.createTextNode("" + this._requ
est.statusCode)); | 2380 this._statusCell.appendChild(document.createTextNode("" + this._requ
est.statusCode)); |
2378 this._appendSubtitle(this._statusCell, this._request.statusText); | 2381 this._appendSubtitle(this._statusCell, this._request.statusText); |
2379 this._statusCell.title = this._request.statusCode + " " + this._requ
est.statusText; | 2382 this._statusCell.title = this._request.statusCode + " " + this._requ
est.statusText; |
2380 if (this._request.cached) | 2383 } else if (this._request.parsedURL.isDataURL()) { |
2381 this._statusCell.classList.add("network-dim-cell"); | 2384 this._statusCell.setTextAndTitle(WebInspector.UIString("(data)")); |
| 2385 } else if (this._request.isPingRequest()) { |
| 2386 this._statusCell.setTextAndTitle(WebInspector.UIString("(ping)")); |
| 2387 } else if (this._request.canceled) { |
| 2388 this._statusCell.setTextAndTitle(WebInspector.UIString("(canceled)")
); |
| 2389 } else if (this._request.finished) { |
| 2390 this._statusCell.setTextAndTitle(WebInspector.UIString("Finished")); |
2382 } else { | 2391 } else { |
2383 if (this._request.parsedURL.isDataURL()) | 2392 this._statusCell.setTextAndTitle(WebInspector.UIString("(pending)"))
; |
2384 this._statusCell.setTextAndTitle(WebInspector.UIString("(data)")
); | |
2385 else if (this._request.isPingRequest()) | |
2386 this._statusCell.setTextAndTitle(WebInspector.UIString("(ping)")
); | |
2387 else if (this._request.finished) | |
2388 this._statusCell.setTextAndTitle(WebInspector.UIString("Finished
")); | |
2389 else | |
2390 this._statusCell.setTextAndTitle(WebInspector.UIString("(pending
)")); | |
2391 this._statusCell.classList.add("network-dim-cell"); | |
2392 } | 2393 } |
2393 }, | 2394 }, |
2394 | 2395 |
2395 _refreshSchemeCell: function() | 2396 _refreshSchemeCell: function() |
2396 { | 2397 { |
2397 this._schemeCell.setTextAndTitle(this._request.scheme); | 2398 this._schemeCell.setTextAndTitle(this._request.scheme); |
2398 }, | 2399 }, |
2399 | 2400 |
2400 _refreshDomainCell: function() | 2401 _refreshDomainCell: function() |
2401 { | 2402 { |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2678 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa
me, revert, a, b) | 2679 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa
me, revert, a, b) |
2679 { | 2680 { |
2680 var aValue = a._request[propertyName]; | 2681 var aValue = a._request[propertyName]; |
2681 var bValue = b._request[propertyName]; | 2682 var bValue = b._request[propertyName]; |
2682 if (aValue > bValue) | 2683 if (aValue > bValue) |
2683 return revert ? -1 : 1; | 2684 return revert ? -1 : 1; |
2684 if (bValue > aValue) | 2685 if (bValue > aValue) |
2685 return revert ? 1 : -1; | 2686 return revert ? 1 : -1; |
2686 return 0; | 2687 return 0; |
2687 } | 2688 } |
OLD | NEW |