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) IBM Corp. 2009 All rights reserved. | 3 * Copyright (C) IBM Corp. 2009 All rights reserved. |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 this._request = request; | 42 this._request = request; |
43 | 43 |
44 this._headersListElement = document.createElement("ol"); | 44 this._headersListElement = document.createElement("ol"); |
45 this._headersListElement.className = "outline-disclosure"; | 45 this._headersListElement.className = "outline-disclosure"; |
46 this.element.appendChild(this._headersListElement); | 46 this.element.appendChild(this._headersListElement); |
47 | 47 |
48 this._headersTreeOutline = new TreeOutline(this._headersListElement); | 48 this._headersTreeOutline = new TreeOutline(this._headersListElement); |
49 this._headersTreeOutline.expandTreeElementsWhenArrowing = true; | 49 this._headersTreeOutline.expandTreeElementsWhenArrowing = true; |
50 | 50 |
| 51 this._remoteAddressTreeElement = new TreeElement("", null, false); |
| 52 this._remoteAddressTreeElement.selectable = false; |
| 53 this._remoteAddressTreeElement.hidden = true; |
| 54 this._headersTreeOutline.appendChild(this._remoteAddressTreeElement); |
| 55 |
51 this._urlTreeElement = new TreeElement("", null, false); | 56 this._urlTreeElement = new TreeElement("", null, false); |
52 this._urlTreeElement.selectable = false; | 57 this._urlTreeElement.selectable = false; |
53 this._headersTreeOutline.appendChild(this._urlTreeElement); | 58 this._headersTreeOutline.appendChild(this._urlTreeElement); |
54 | 59 |
55 this._requestMethodTreeElement = new TreeElement("", null, false); | 60 this._requestMethodTreeElement = new TreeElement("", null, false); |
56 this._requestMethodTreeElement.selectable = false; | 61 this._requestMethodTreeElement.selectable = false; |
57 this._headersTreeOutline.appendChild(this._requestMethodTreeElement); | 62 this._headersTreeOutline.appendChild(this._requestMethodTreeElement); |
58 | 63 |
59 this._statusCodeTreeElement = new TreeElement("", null, false); | 64 this._statusCodeTreeElement = new TreeElement("", null, false); |
60 this._statusCodeTreeElement.selectable = false; | 65 this._statusCodeTreeElement.selectable = false; |
(...skipping 30 matching lines...) Expand all Loading... |
91 this._responseHeadersTreeElement = new TreeElement("", null, true); | 96 this._responseHeadersTreeElement = new TreeElement("", null, true); |
92 this._responseHeadersTreeElement.expanded = true; | 97 this._responseHeadersTreeElement.expanded = true; |
93 this._responseHeadersTreeElement.selectable = false; | 98 this._responseHeadersTreeElement.selectable = false; |
94 this._headersTreeOutline.appendChild(this._responseHeadersTreeElement); | 99 this._headersTreeOutline.appendChild(this._responseHeadersTreeElement); |
95 } | 100 } |
96 | 101 |
97 WebInspector.RequestHeadersView.prototype = { | 102 WebInspector.RequestHeadersView.prototype = { |
98 | 103 |
99 wasShown: function() | 104 wasShown: function() |
100 { | 105 { |
| 106 this._request.addEventListener(WebInspector.NetworkRequest.Events.Remote
AddressChanged, this._refreshRemoteAddress, this); |
101 this._request.addEventListener(WebInspector.NetworkRequest.Events.Reques
tHeadersChanged, this._refreshRequestHeaders, this); | 107 this._request.addEventListener(WebInspector.NetworkRequest.Events.Reques
tHeadersChanged, this._refreshRequestHeaders, this); |
102 this._request.addEventListener(WebInspector.NetworkRequest.Events.Respon
seHeadersChanged, this._refreshResponseHeaders, this); | 108 this._request.addEventListener(WebInspector.NetworkRequest.Events.Respon
seHeadersChanged, this._refreshResponseHeaders, this); |
103 this._request.addEventListener(WebInspector.NetworkRequest.Events.Finish
edLoading, this._refreshHTTPInformation, this); | 109 this._request.addEventListener(WebInspector.NetworkRequest.Events.Finish
edLoading, this._refreshHTTPInformation, this); |
104 | 110 |
105 this._refreshURL(); | 111 this._refreshURL(); |
106 this._refreshQueryString(); | 112 this._refreshQueryString(); |
107 this._refreshRequestHeaders(); | 113 this._refreshRequestHeaders(); |
108 this._refreshResponseHeaders(); | 114 this._refreshResponseHeaders(); |
109 this._refreshHTTPInformation(); | 115 this._refreshHTTPInformation(); |
| 116 this._refreshRemoteAddress(); |
110 }, | 117 }, |
111 | 118 |
112 willHide: function() | 119 willHide: function() |
113 { | 120 { |
| 121 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Rem
oteAddressChanged, this._refreshRemoteAddress, this); |
114 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Req
uestHeadersChanged, this._refreshRequestHeaders, this); | 122 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Req
uestHeadersChanged, this._refreshRequestHeaders, this); |
115 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Res
ponseHeadersChanged, this._refreshResponseHeaders, this); | 123 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Res
ponseHeadersChanged, this._refreshResponseHeaders, this); |
116 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Fin
ishedLoading, this._refreshHTTPInformation, this); | 124 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Fin
ishedLoading, this._refreshHTTPInformation, this); |
117 }, | 125 }, |
118 | 126 |
119 /** | 127 /** |
120 * @param {string} name | 128 * @param {string} name |
121 * @param {string} value | 129 * @param {string} value |
122 * @return {!DocumentFragment} | 130 * @return {!DocumentFragment} |
123 */ | 131 */ |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 * @param {number} count | 449 * @param {number} count |
442 * @param {string} headersText | 450 * @param {string} headersText |
443 * @param {!TreeElement} headersTreeElement | 451 * @param {!TreeElement} headersTreeElement |
444 */ | 452 */ |
445 _refreshHeadersText: function(title, count, headersText, headersTreeElement) | 453 _refreshHeadersText: function(title, count, headersText, headersTreeElement) |
446 { | 454 { |
447 this._populateTreeElementWithSourceText(headersTreeElement, headersText)
; | 455 this._populateTreeElementWithSourceText(headersTreeElement, headersText)
; |
448 this._refreshHeadersTitle(title, headersTreeElement, count); | 456 this._refreshHeadersTitle(title, headersTreeElement, count); |
449 }, | 457 }, |
450 | 458 |
| 459 _refreshRemoteAddress: function() |
| 460 { |
| 461 var remoteAddress = this._request.remoteAddress(); |
| 462 var treeElement = this._remoteAddressTreeElement; |
| 463 treeElement.hidden = !remoteAddress; |
| 464 if (remoteAddress) |
| 465 treeElement.title = this._formatHeader(WebInspector.UIString("Remote
Address"), remoteAddress); |
| 466 }, |
| 467 |
451 /** | 468 /** |
452 * @param {?Event} event | 469 * @param {?Event} event |
453 */ | 470 */ |
454 _toggleRequestHeadersText: function(event) | 471 _toggleRequestHeadersText: function(event) |
455 { | 472 { |
456 this._showRequestHeadersText = !this._showRequestHeadersText; | 473 this._showRequestHeadersText = !this._showRequestHeadersText; |
457 this._refreshRequestHeaders(); | 474 this._refreshRequestHeaders(); |
458 }, | 475 }, |
459 | 476 |
460 /** | 477 /** |
(...skipping 22 matching lines...) Expand all Loading... |
483 * @return {!Element} | 500 * @return {!Element} |
484 */ | 501 */ |
485 _createHeadersToggleButton: function(isHeadersTextShown) | 502 _createHeadersToggleButton: function(isHeadersTextShown) |
486 { | 503 { |
487 var toggleTitle = isHeadersTextShown ? WebInspector.UIString("view parse
d") : WebInspector.UIString("view source"); | 504 var toggleTitle = isHeadersTextShown ? WebInspector.UIString("view parse
d") : WebInspector.UIString("view source"); |
488 return this._createToggleButton(toggleTitle); | 505 return this._createToggleButton(toggleTitle); |
489 }, | 506 }, |
490 | 507 |
491 __proto__: WebInspector.View.prototype | 508 __proto__: WebInspector.View.prototype |
492 } | 509 } |
OLD | NEW |