| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 this._request = request; | 42 this._request = request; |
| 43 } | 43 } |
| 44 | 44 |
| 45 WebInspector.RequestCookiesView.prototype = { | 45 WebInspector.RequestCookiesView.prototype = { |
| 46 wasShown: function() | 46 wasShown: function() |
| 47 { | 47 { |
| 48 this._request.addEventListener(WebInspector.NetworkRequest.Events.Reques
tHeadersChanged, this._refreshCookies, this); | 48 this._request.addEventListener(WebInspector.NetworkRequest.Events.Reques
tHeadersChanged, this._refreshCookies, this); |
| 49 this._request.addEventListener(WebInspector.NetworkRequest.Events.Respon
seHeadersChanged, this._refreshCookies, this); | 49 this._request.addEventListener(WebInspector.NetworkRequest.Events.Respon
seHeadersChanged, this._refreshCookies, this); |
| 50 | 50 |
| 51 if (!this._gotCookies) { | 51 if (!this._gotCookies) { |
| 52 if (!this._emptyView) { | 52 if (!this._emptyWidget) { |
| 53 this._emptyView = new WebInspector.EmptyView(WebInspector.UIStri
ng("This request has no cookies.")); | 53 this._emptyWidget = new WebInspector.EmptyWidget(WebInspector.UI
String("This request has no cookies.")); |
| 54 this._emptyView.show(this.element); | 54 this._emptyWidget.show(this.element); |
| 55 } | 55 } |
| 56 return; | 56 return; |
| 57 } | 57 } |
| 58 | 58 |
| 59 if (!this._cookiesTable) | 59 if (!this._cookiesTable) |
| 60 this._buildCookiesTable(); | 60 this._buildCookiesTable(); |
| 61 }, | 61 }, |
| 62 | 62 |
| 63 willHide: function() | 63 willHide: function() |
| 64 { | 64 { |
| 65 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Req
uestHeadersChanged, this._refreshCookies, this); | 65 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Req
uestHeadersChanged, this._refreshCookies, this); |
| 66 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Res
ponseHeadersChanged, this._refreshCookies, this); | 66 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Res
ponseHeadersChanged, this._refreshCookies, this); |
| 67 }, | 67 }, |
| 68 | 68 |
| 69 get _gotCookies() | 69 get _gotCookies() |
| 70 { | 70 { |
| 71 return (this._request.requestCookies && this._request.requestCookies.len
gth) || (this._request.responseCookies && this._request.responseCookies.length); | 71 return (this._request.requestCookies && this._request.requestCookies.len
gth) || (this._request.responseCookies && this._request.responseCookies.length); |
| 72 }, | 72 }, |
| 73 | 73 |
| 74 _buildCookiesTable: function() | 74 _buildCookiesTable: function() |
| 75 { | 75 { |
| 76 this.detachChildViews(); | 76 this.detachChildWidgets(); |
| 77 | 77 |
| 78 this._cookiesTable = new WebInspector.CookiesTable(true); | 78 this._cookiesTable = new WebInspector.CookiesTable(true); |
| 79 this._cookiesTable.setCookieFolders([ | 79 this._cookiesTable.setCookieFolders([ |
| 80 {folderName: WebInspector.UIString("Request Cookies"), cookies: this
._request.requestCookies}, | 80 {folderName: WebInspector.UIString("Request Cookies"), cookies: this
._request.requestCookies}, |
| 81 {folderName: WebInspector.UIString("Response Cookies"), cookies: thi
s._request.responseCookies} | 81 {folderName: WebInspector.UIString("Response Cookies"), cookies: thi
s._request.responseCookies} |
| 82 ]); | 82 ]); |
| 83 this._cookiesTable.show(this.element); | 83 this._cookiesTable.show(this.element); |
| 84 }, | 84 }, |
| 85 | 85 |
| 86 _refreshCookies: function() | 86 _refreshCookies: function() |
| 87 { | 87 { |
| 88 delete this._cookiesTable; | 88 delete this._cookiesTable; |
| 89 if (!this._gotCookies || !this.isShowing()) | 89 if (!this._gotCookies || !this.isShowing()) |
| 90 return; | 90 return; |
| 91 this._buildCookiesTable(); | 91 this._buildCookiesTable(); |
| 92 }, | 92 }, |
| 93 | 93 |
| 94 __proto__: WebInspector.VBox.prototype | 94 __proto__: WebInspector.VBox.prototype |
| 95 } | 95 } |
| OLD | NEW |