| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @unrestricted | 32 * @unrestricted |
| 33 */ | 33 */ |
| 34 WebInspector.RequestCookiesView = class extends WebInspector.VBox { | 34 Network.RequestCookiesView = class extends UI.VBox { |
| 35 /** | 35 /** |
| 36 * @param {!WebInspector.NetworkRequest} request | 36 * @param {!SDK.NetworkRequest} request |
| 37 */ | 37 */ |
| 38 constructor(request) { | 38 constructor(request) { |
| 39 super(); | 39 super(); |
| 40 this.registerRequiredCSS('network/requestCookiesView.css'); | 40 this.registerRequiredCSS('network/requestCookiesView.css'); |
| 41 this.element.classList.add('request-cookies-view'); | 41 this.element.classList.add('request-cookies-view'); |
| 42 | 42 |
| 43 this._request = request; | 43 this._request = request; |
| 44 } | 44 } |
| 45 | 45 |
| 46 /** | 46 /** |
| 47 * @override | 47 * @override |
| 48 */ | 48 */ |
| 49 wasShown() { | 49 wasShown() { |
| 50 this._request.addEventListener( | 50 this._request.addEventListener( |
| 51 WebInspector.NetworkRequest.Events.RequestHeadersChanged, this._refreshC
ookies, this); | 51 SDK.NetworkRequest.Events.RequestHeadersChanged, this._refreshCookies, t
his); |
| 52 this._request.addEventListener( | 52 this._request.addEventListener( |
| 53 WebInspector.NetworkRequest.Events.ResponseHeadersChanged, this._refresh
Cookies, this); | 53 SDK.NetworkRequest.Events.ResponseHeadersChanged, this._refreshCookies,
this); |
| 54 | 54 |
| 55 if (!this._gotCookies) { | 55 if (!this._gotCookies) { |
| 56 if (!this._emptyWidget) { | 56 if (!this._emptyWidget) { |
| 57 this._emptyWidget = new WebInspector.EmptyWidget(WebInspector.UIString('
This request has no cookies.')); | 57 this._emptyWidget = new UI.EmptyWidget(Common.UIString('This request has
no cookies.')); |
| 58 this._emptyWidget.show(this.element); | 58 this._emptyWidget.show(this.element); |
| 59 } | 59 } |
| 60 return; | 60 return; |
| 61 } | 61 } |
| 62 | 62 |
| 63 if (!this._cookiesTable) | 63 if (!this._cookiesTable) |
| 64 this._buildCookiesTable(); | 64 this._buildCookiesTable(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * @override | 68 * @override |
| 69 */ | 69 */ |
| 70 willHide() { | 70 willHide() { |
| 71 this._request.removeEventListener( | 71 this._request.removeEventListener( |
| 72 WebInspector.NetworkRequest.Events.RequestHeadersChanged, this._refreshC
ookies, this); | 72 SDK.NetworkRequest.Events.RequestHeadersChanged, this._refreshCookies, t
his); |
| 73 this._request.removeEventListener( | 73 this._request.removeEventListener( |
| 74 WebInspector.NetworkRequest.Events.ResponseHeadersChanged, this._refresh
Cookies, this); | 74 SDK.NetworkRequest.Events.ResponseHeadersChanged, this._refreshCookies,
this); |
| 75 } | 75 } |
| 76 | 76 |
| 77 get _gotCookies() { | 77 get _gotCookies() { |
| 78 return (this._request.requestCookies && this._request.requestCookies.length)
|| | 78 return (this._request.requestCookies && this._request.requestCookies.length)
|| |
| 79 (this._request.responseCookies && this._request.responseCookies.length); | 79 (this._request.responseCookies && this._request.responseCookies.length); |
| 80 } | 80 } |
| 81 | 81 |
| 82 _buildCookiesTable() { | 82 _buildCookiesTable() { |
| 83 this.detachChildWidgets(); | 83 this.detachChildWidgets(); |
| 84 | 84 |
| 85 this._cookiesTable = new WebInspector.CookiesTable(true); | 85 this._cookiesTable = new Components.CookiesTable(true); |
| 86 this._cookiesTable.setCookieFolders([ | 86 this._cookiesTable.setCookieFolders([ |
| 87 {folderName: WebInspector.UIString('Request Cookies'), cookies: this._requ
est.requestCookies}, | 87 {folderName: Common.UIString('Request Cookies'), cookies: this._request.re
questCookies}, |
| 88 {folderName: WebInspector.UIString('Response Cookies'), cookies: this._req
uest.responseCookies} | 88 {folderName: Common.UIString('Response Cookies'), cookies: this._request.r
esponseCookies} |
| 89 ]); | 89 ]); |
| 90 this._cookiesTable.show(this.element); | 90 this._cookiesTable.show(this.element); |
| 91 } | 91 } |
| 92 | 92 |
| 93 _refreshCookies() { | 93 _refreshCookies() { |
| 94 delete this._cookiesTable; | 94 delete this._cookiesTable; |
| 95 if (!this._gotCookies || !this.isShowing()) | 95 if (!this._gotCookies || !this.isShowing()) |
| 96 return; | 96 return; |
| 97 this._buildCookiesTable(); | 97 this._buildCookiesTable(); |
| 98 } | 98 } |
| 99 }; | 99 }; |
| OLD | NEW |