| 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 2285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2296 this._refreshTimeCell(); | 2296 this._refreshTimeCell(); |
| 2297 | 2297 |
| 2298 var responseHeaderColumns = WebInspector.NetworkLogView._responseHeaderC
olumns; | 2298 var responseHeaderColumns = WebInspector.NetworkLogView._responseHeaderC
olumns; |
| 2299 for (var i = 0; i < responseHeaderColumns.length; ++i) | 2299 for (var i = 0; i < responseHeaderColumns.length; ++i) |
| 2300 this._refreshResponseHeaderCell(responseHeaderColumns[i]); | 2300 this._refreshResponseHeaderCell(responseHeaderColumns[i]); |
| 2301 | 2301 |
| 2302 if (this._request.cached) | 2302 if (this._request.cached) |
| 2303 this._timelineCell.classList.add("resource-cached"); | 2303 this._timelineCell.classList.add("resource-cached"); |
| 2304 | 2304 |
| 2305 this._element.classList.add("network-item"); | 2305 this._element.classList.add("network-item"); |
| 2306 this._element.enableStyleClass("network-error-row", this._request.failed
|| (this._request.statusCode >= 400)); | 2306 this._element.enableStyleClass("network-error-row", this._isFailed()); |
| 2307 this._updateElementStyleClasses(this._element); | 2307 this._updateElementStyleClasses(this._element); |
| 2308 }, | 2308 }, |
| 2309 | 2309 |
| 2310 /** | 2310 /** |
| 2311 * @return {boolean} |
| 2312 */ |
| 2313 _isFailed: function() |
| 2314 { |
| 2315 return !!this._request.failed || (this._request.statusCode >= 400); |
| 2316 }, |
| 2317 |
| 2318 /** |
| 2311 * @param {!Element} element | 2319 * @param {!Element} element |
| 2312 */ | 2320 */ |
| 2313 _updateElementStyleClasses: function(element) | 2321 _updateElementStyleClasses: function(element) |
| 2314 { | 2322 { |
| 2315 var typeClassName = "network-type-" + this._request.type.name(); | 2323 var typeClassName = "network-type-" + this._request.type.name(); |
| 2316 if (!element.classList.contains(typeClassName)) { | 2324 if (!element.classList.contains(typeClassName)) { |
| 2317 element.removeMatchingStyleClasses("network-type-\\w+"); | 2325 element.removeMatchingStyleClasses("network-type-\\w+"); |
| 2318 element.classList.add(typeClassName); | 2326 element.classList.add(typeClassName); |
| 2319 } | 2327 } |
| 2320 }, | 2328 }, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2349 }, | 2357 }, |
| 2350 | 2358 |
| 2351 _refreshMethodCell: function() | 2359 _refreshMethodCell: function() |
| 2352 { | 2360 { |
| 2353 this._methodCell.setTextAndTitle(this._request.requestMethod); | 2361 this._methodCell.setTextAndTitle(this._request.requestMethod); |
| 2354 }, | 2362 }, |
| 2355 | 2363 |
| 2356 _refreshStatusCell: function() | 2364 _refreshStatusCell: function() |
| 2357 { | 2365 { |
| 2358 this._statusCell.removeChildren(); | 2366 this._statusCell.removeChildren(); |
| 2367 this._statusCell.enableStyleClass("network-dim-cell", !this._isFailed()
&& (this._request.cached || !this._request.statusCode)); |
| 2359 | 2368 |
| 2360 if (this._request.failed) { | 2369 if (this._request.failed && !this._request.canceled) { |
| 2361 var failText = this._request.canceled ? WebInspector.UIString("(canc
eled)") : WebInspector.UIString("(failed)"); | 2370 var failText = WebInspector.UIString("(failed)"); |
| 2362 if (this._request.localizedFailDescription) { | 2371 if (this._request.localizedFailDescription) { |
| 2363 this._statusCell.appendChild(document.createTextNode(failText)); | 2372 this._statusCell.appendChild(document.createTextNode(failText)); |
| 2364 this._appendSubtitle(this._statusCell, this._request.localizedFa
ilDescription); | 2373 this._appendSubtitle(this._statusCell, this._request.localizedFa
ilDescription); |
| 2365 this._statusCell.title = failText + " " + this._request.localize
dFailDescription; | 2374 this._statusCell.title = failText + " " + this._request.localize
dFailDescription; |
| 2366 } else | 2375 } else |
| 2367 this._statusCell.setTextAndTitle(failText); | 2376 this._statusCell.setTextAndTitle(failText); |
| 2368 this._statusCell.classList.add("network-dim-cell"); | 2377 } else if (this._request.statusCode) { |
| 2369 return; | |
| 2370 } | |
| 2371 | |
| 2372 this._statusCell.classList.remove("network-dim-cell"); | |
| 2373 | |
| 2374 if (this._request.statusCode) { | |
| 2375 this._statusCell.appendChild(document.createTextNode("" + this._requ
est.statusCode)); | 2378 this._statusCell.appendChild(document.createTextNode("" + this._requ
est.statusCode)); |
| 2376 this._appendSubtitle(this._statusCell, this._request.statusText); | 2379 this._appendSubtitle(this._statusCell, this._request.statusText); |
| 2377 this._statusCell.title = this._request.statusCode + " " + this._requ
est.statusText; | 2380 this._statusCell.title = this._request.statusCode + " " + this._requ
est.statusText; |
| 2378 if (this._request.cached) | 2381 } else if (this._request.parsedURL.isDataURL()) { |
| 2379 this._statusCell.classList.add("network-dim-cell"); | 2382 this._statusCell.setTextAndTitle(WebInspector.UIString("(data)")); |
| 2383 } else if (this._request.isPingRequest()) { |
| 2384 this._statusCell.setTextAndTitle(WebInspector.UIString("(ping)")); |
| 2385 } else if (this._request.canceled) { |
| 2386 this._statusCell.setTextAndTitle(WebInspector.UIString("(canceled)")
); |
| 2387 } else if (this._request.finished) { |
| 2388 this._statusCell.setTextAndTitle(WebInspector.UIString("Finished")); |
| 2380 } else { | 2389 } else { |
| 2381 if (this._request.parsedURL.isDataURL()) | 2390 this._statusCell.setTextAndTitle(WebInspector.UIString("(pending)"))
; |
| 2382 this._statusCell.setTextAndTitle(WebInspector.UIString("(data)")
); | |
| 2383 else if (this._request.isPingRequest()) | |
| 2384 this._statusCell.setTextAndTitle(WebInspector.UIString("(ping)")
); | |
| 2385 else if (this._request.finished) | |
| 2386 this._statusCell.setTextAndTitle(WebInspector.UIString("Finished
")); | |
| 2387 else | |
| 2388 this._statusCell.setTextAndTitle(WebInspector.UIString("(pending
)")); | |
| 2389 this._statusCell.classList.add("network-dim-cell"); | |
| 2390 } | 2391 } |
| 2391 }, | 2392 }, |
| 2392 | 2393 |
| 2393 _refreshSchemeCell: function() | 2394 _refreshSchemeCell: function() |
| 2394 { | 2395 { |
| 2395 this._schemeCell.setTextAndTitle(this._request.scheme); | 2396 this._schemeCell.setTextAndTitle(this._request.scheme); |
| 2396 }, | 2397 }, |
| 2397 | 2398 |
| 2398 _refreshDomainCell: function() | 2399 _refreshDomainCell: function() |
| 2399 { | 2400 { |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2676 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa
me, revert, a, b) | 2677 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa
me, revert, a, b) |
| 2677 { | 2678 { |
| 2678 var aValue = a._request[propertyName]; | 2679 var aValue = a._request[propertyName]; |
| 2679 var bValue = b._request[propertyName]; | 2680 var bValue = b._request[propertyName]; |
| 2680 if (aValue > bValue) | 2681 if (aValue > bValue) |
| 2681 return revert ? -1 : 1; | 2682 return revert ? -1 : 1; |
| 2682 if (bValue > aValue) | 2683 if (bValue > aValue) |
| 2683 return revert ? 1 : -1; | 2684 return revert ? 1 : -1; |
| 2684 return 0; | 2685 return 0; |
| 2685 } | 2686 } |
| OLD | NEW |