[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
caseq at chromium.org
caseq at chromium.org
Wed Dec 22 14:57:50 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 816c93b479af17edfd5892d378675fe7f9d87fe9
Author: caseq at chromium.org <caseq at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Oct 26 16:24:43 2010 +0000
2010-10-25 Andrey Kosyakov <caseq at chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: Show cookie data in the request headers in network pane
https://bugs.webkit.org/show_bug.cgi?id=16531
* inspector/front-end/CookieItemsView.js:
(WebInspector.CookieItemsView): Factor out common cookies grid logic to CookiesTable
(WebInspector.CookieItemsView.prototype._populateDataGrid):
* inspector/front-end/CookieParser.js: Store cookie type (request/response) within a cookie.
(WebInspector.CookieParser.prototype.parseCookie):
(WebInspector.CookieParser.prototype.parseSetCookie):
(WebInspector.CookieParser.prototype._addCookie):
(WebInspector.Cookie):
* inspector/front-end/DataGrid.js:
(WebInspector.DataGrid.prototype.autoSizeColumns): Optionally, traverse nested nodes when looking for max field widths.
(WebInspector.DataGrid.prototype._enumerateChildren):
(WebInspector.DataGrid.prototype.updateWidths): Skip attempt to calculate column widths if grid is not attached to DOM tree yet.
* inspector/front-end/FontView.js:
(WebInspector.FontView.prototype.resize):
* inspector/front-end/ResourceView.js:
(WebInspector.ResourceView.prototype.resize):
(WebInspector.ResourceView.prototype._selectTab):
(WebInspector.ResourceView.prototype._selectCookiesTab):
(WebInspector.ResourceView.prototype._innerSelectContentTab):
(WebInspector.ResourceView.prototype._refreshRequestHeaders):
(WebInspector.ResourceView.prototype._refreshResponseHeaders):
(WebInspector.ResourceView.prototype._refreshHeaders):
(WebInspector.ResourceView.prototype._refreshCookies):
(WebInspector.ResourceCookiesTab):
(WebInspector.ResourceCookiesTab.prototype.set requestCookies):
(WebInspector.ResourceCookiesTab.prototype.set responseCookies):
(WebInspector.ResourceCookiesTab.prototype._populateDataGrid):
(WebInspector.ResourceCookiesTab.prototype._populateCookies):
(WebInspector.ResourceCookiesTab.prototype._createFolder):
* inspector/front-end/SourceView.js:
(WebInspector.SourceView.prototype.resize):
* inspector/front-end/inspector.css:
(.resource-view .resource-view-cookies):
(.resource-view.headers-visible .resource-view-cookies):
(.resource-view-cookies.table .data-grid):
(.resource-view-cookies .data-grid .row-group):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70529 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9777bb9..cfbe3ea 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,47 @@
+2010-10-25 Andrey Kosyakov <caseq at chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: Show cookie data in the request headers in network pane
+ https://bugs.webkit.org/show_bug.cgi?id=16531
+
+ * inspector/front-end/CookieItemsView.js:
+ (WebInspector.CookieItemsView): Factor out common cookies grid logic to CookiesTable
+ (WebInspector.CookieItemsView.prototype._populateDataGrid):
+ * inspector/front-end/CookieParser.js: Store cookie type (request/response) within a cookie.
+ (WebInspector.CookieParser.prototype.parseCookie):
+ (WebInspector.CookieParser.prototype.parseSetCookie):
+ (WebInspector.CookieParser.prototype._addCookie):
+ (WebInspector.Cookie):
+ * inspector/front-end/DataGrid.js:
+ (WebInspector.DataGrid.prototype.autoSizeColumns): Optionally, traverse nested nodes when looking for max field widths.
+ (WebInspector.DataGrid.prototype._enumerateChildren):
+ (WebInspector.DataGrid.prototype.updateWidths): Skip attempt to calculate column widths if grid is not attached to DOM tree yet.
+ * inspector/front-end/FontView.js:
+ (WebInspector.FontView.prototype.resize):
+ * inspector/front-end/ResourceView.js:
+ (WebInspector.ResourceView.prototype.resize):
+ (WebInspector.ResourceView.prototype._selectTab):
+ (WebInspector.ResourceView.prototype._selectCookiesTab):
+ (WebInspector.ResourceView.prototype._innerSelectContentTab):
+ (WebInspector.ResourceView.prototype._refreshRequestHeaders):
+ (WebInspector.ResourceView.prototype._refreshResponseHeaders):
+ (WebInspector.ResourceView.prototype._refreshHeaders):
+ (WebInspector.ResourceView.prototype._refreshCookies):
+ (WebInspector.ResourceCookiesTab):
+ (WebInspector.ResourceCookiesTab.prototype.set requestCookies):
+ (WebInspector.ResourceCookiesTab.prototype.set responseCookies):
+ (WebInspector.ResourceCookiesTab.prototype._populateDataGrid):
+ (WebInspector.ResourceCookiesTab.prototype._populateCookies):
+ (WebInspector.ResourceCookiesTab.prototype._createFolder):
+ * inspector/front-end/SourceView.js:
+ (WebInspector.SourceView.prototype.resize):
+ * inspector/front-end/inspector.css:
+ (.resource-view .resource-view-cookies):
+ (.resource-view.headers-visible .resource-view-cookies):
+ (.resource-view-cookies.table .data-grid):
+ (.resource-view-cookies .data-grid .row-group):
+
2010-10-26 Sheriff Bot <webkit.review.bot at gmail.com>
Unreviewed, rolling out r70518.
diff --git a/WebCore/English.lproj/localizedStrings.js b/WebCore/English.lproj/localizedStrings.js
index fc8fd2e..7403b22 100644
Binary files a/WebCore/English.lproj/localizedStrings.js and b/WebCore/English.lproj/localizedStrings.js differ
diff --git a/WebCore/inspector/front-end/CookieItemsView.js b/WebCore/inspector/front-end/CookieItemsView.js
index 0b05f2a..592b4a6 100644
--- a/WebCore/inspector/front-end/CookieItemsView.js
+++ b/WebCore/inspector/front-end/CookieItemsView.js
@@ -27,12 +27,141 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.CookieItemsView = function(treeElement, cookieDomain)
+WebInspector.CookiesTable = function()
{
WebInspector.View.call(this);
- this.element.addStyleClass("storage-view");
this.element.addStyleClass("table");
+}
+
+WebInspector.CookiesTable.prototype = {
+ resize: function()
+ {
+ if (!this._dataGrid)
+ return;
+
+ if (this._autoSizingDone)
+ this._dataGrid.updateWidths();
+ else {
+ this._autoSizingDone = true;
+ this._dataGrid.autoSizeColumns(4, 45, 1);
+ }
+ },
+
+ _createDataGrid: function(expandable)
+ {
+ var columns = { 0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {} };
+ columns[0].title = WebInspector.UIString("Name");
+ columns[0].sortable = true;
+ columns[0].disclosure = expandable;
+ columns[1].title = WebInspector.UIString("Value");
+ columns[1].sortable = true;
+ columns[2].title = WebInspector.UIString("Domain");
+ columns[2].sortable = true;
+ columns[3].title = WebInspector.UIString("Path");
+ columns[3].sortable = true;
+ columns[4].title = WebInspector.UIString("Expires");
+ columns[4].sortable = true;
+ columns[5].title = WebInspector.UIString("Size");
+ columns[5].aligned = "right";
+ columns[5].sortable = true;
+ columns[6].title = WebInspector.UIString("HTTP");
+ columns[6].aligned = "centered";
+ columns[6].sortable = true;
+ columns[7].title = WebInspector.UIString("Secure");
+ columns[7].aligned = "centered";
+ columns[7].sortable = true;
+
+ var deleteCallback = this._deleteCookieCallback ? this._deleteCookieCallback.bind(this) : null;
+ this._dataGrid = new WebInspector.DataGrid(columns, null, deleteCallback);
+ this._dataGrid.addEventListener("sorting changed", this._populateDataGrid, this);
+ this.element.appendChild(this._dataGrid.element);
+ },
+
+ _populateCookies: function(parentNode, cookies)
+ {
+ var selectedCookie = this._dataGrid.selectedNode ? this._dataGrid.selectedNode.cookie : null;
+ parentNode.removeChildren();
+ if (!cookies)
+ return;
+ this._sortCookies(cookies);
+ var totalSize = 0;
+ for (var i = 0; i < cookies.length; ++i) {
+ var cookieNode = this._createGridNode(cookies[i]);
+ parentNode.appendChild(cookieNode);
+ if (selectedCookie === cookies[i])
+ cookieNode.selected = true;
+ }
+ },
+
+ _sortCookies: function(cookies)
+ {
+ var sortDirection = this._dataGrid.sortOrder === "ascending" ? 1 : -1;
+
+ function localeCompare(field, cookie1, cookie2)
+ {
+ return sortDirection * (cookie1[field] + "").localeCompare(cookie2[field] + "")
+ }
+
+ function numberCompare(field, cookie1, cookie2)
+ {
+ return sortDirection * (cookie1[field] - cookie2[field]);
+ }
+
+ function expiresCompare(cookie1, cookie2)
+ {
+ if (cookie1.session !== cookie2.session)
+ return sortDirection * (cookie1.session ? 1 : -1);
+
+ if (cookie1.session)
+ return 0;
+
+ return sortDirection * (cookie1.expires - cookie2.expires);
+ }
+
+ var comparator;
+ switch (parseInt(this._dataGrid.sortColumnIdentifier)) {
+ case 0: comparator = localeCompare.bind(this, "name"); break;
+ case 1: comparator = localeCompare.bind(this, "value"); break;
+ case 2: comparator = localeCompare.bind(this, "domain"); break;
+ case 3: comparator = localeCompare.bind(this, "path"); break;
+ case 4: comparator = expiresCompare; break;
+ case 5: comparator = numberCompare.bind(this, "size"); break;
+ case 6: comparator = localeCompare.bind(this, "httpOnly"); break;
+ case 7: comparator = localeCompare.bind(this, "secure"); break;
+ default: localeCompare.bind(this, "name");
+ }
+
+ cookies.sort(comparator);
+ },
+
+ _createGridNode: function(cookie)
+ {
+ var data = {};
+ data[0] = cookie.name;
+ data[1] = cookie.value;
+ data[2] = cookie.domain || "";
+ data[3] = cookie.path || "";
+ data[4] = cookie.type === WebInspector.Cookie.Type.Request ? "" :
+ (cookie.session ? WebInspector.UIString("Session") : new Date(cookie.expires).toGMTString());
+ data[5] = cookie.size;
+ data[6] = (cookie.httpOnly ? "\u2713" : ""); // Checkmark
+ data[7] = (cookie.secure ? "\u2713" : ""); // Checkmark
+
+ var node = new WebInspector.DataGridNode(data);
+ node.cookie = cookie;
+ node.selectable = true;
+ return node;
+ }
+};
+
+WebInspector.CookiesTable.prototype.__proto__ = WebInspector.View.prototype;
+
+WebInspector.CookieItemsView = function(treeElement, cookieDomain)
+{
+ WebInspector.CookiesTable.call(this);
+
+ this.element.addStyleClass("storage-view");
this.deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item");
this.deleteButton.visible = false;
@@ -143,101 +272,9 @@ WebInspector.CookieItemsView.prototype = {
}
},
- _createDataGrid: function()
- {
- var columns = { 0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {} };
- columns[0].title = WebInspector.UIString("Name");
- columns[0].sortable = true;
- columns[1].title = WebInspector.UIString("Value");
- columns[1].sortable = true;
- columns[2].title = WebInspector.UIString("Domain");
- columns[2].sortable = true;
- columns[3].title = WebInspector.UIString("Path");
- columns[3].sortable = true;
- columns[4].title = WebInspector.UIString("Expires");
- columns[4].sortable = true;
- columns[5].title = WebInspector.UIString("Size");
- columns[5].aligned = "right";
- columns[5].sortable = true;
- columns[6].title = WebInspector.UIString("HTTP");
- columns[6].aligned = "centered";
- columns[6].sortable = true;
- columns[7].title = WebInspector.UIString("Secure");
- columns[7].aligned = "centered";
- columns[7].sortable = true;
-
- this._dataGrid = new WebInspector.DataGrid(columns, null, this._deleteCookieCallback.bind(this));
- this._dataGrid.addEventListener("sorting changed", this._populateDataGrid, this);
- this.element.appendChild(this._dataGrid.element);
- this._dataGrid.updateWidths();
- },
-
_populateDataGrid: function()
{
- var selectedCookie = this._dataGrid.selectedNode ? this._dataGrid.selectedNode.cookie : null;
- var sortDirection = this._dataGrid.sortOrder === "ascending" ? 1 : -1;
-
- function localeCompare(field, cookie1, cookie2)
- {
- return sortDirection * (cookie1[field] + "").localeCompare(cookie2[field] + "")
- }
-
- function numberCompare(field, cookie1, cookie2)
- {
- return sortDirection * (cookie1[field] - cookie2[field]);
- }
-
- function expiresCompare(cookie1, cookie2)
- {
- if (cookie1.session !== cookie2.session)
- return sortDirection * (cookie1.session ? 1 : -1);
-
- if (cookie1.session)
- return 0;
-
- return sortDirection * (cookie1.expires - cookie2.expires);
- }
-
- var comparator;
- switch (parseInt(this._dataGrid.sortColumnIdentifier)) {
- case 0: comparator = localeCompare.bind(this, "name"); break;
- case 1: comparator = localeCompare.bind(this, "value"); break;
- case 2: comparator = localeCompare.bind(this, "domain"); break;
- case 3: comparator = localeCompare.bind(this, "path"); break;
- case 4: comparator = expiresCompare; break;
- case 5: comparator = numberCompare.bind(this, "size"); break;
- case 6: comparator = localeCompare.bind(this, "httpOnly"); break;
- case 7: comparator = localeCompare.bind(this, "secure"); break;
- default: localeCompare.bind(this, "name");
- }
-
- this._cookies.sort(comparator);
-
- this._dataGrid.removeChildren();
- var nodeToSelect;
- for (var i = 0; i < this._cookies.length; ++i) {
- var data = {};
- var cookie = this._cookies[i];
- data[0] = cookie.name;
- data[1] = cookie.value;
- data[2] = cookie.domain;
- data[3] = cookie.path;
- data[4] = (cookie.session ? WebInspector.UIString("Session") : new Date(cookie.expires).toGMTString());
- data[5] = Number.bytesToString(cookie.size, WebInspector.UIString);
- data[6] = (cookie.httpOnly ? "\u2713" : ""); // Checkmark
- data[7] = (cookie.secure ? "\u2713" : ""); // Checkmark
-
- var node = new WebInspector.DataGridNode(data);
- node.cookie = cookie;
- node.selectable = true;
- this._dataGrid.appendChild(node);
- if (cookie === selectedCookie)
- nodeToSelect = node;
- }
- if (nodeToSelect)
- nodeToSelect.selected = true;
- else
- this._dataGrid.children[0].selected = true;
+ this._populateCookies(this._dataGrid, this._cookies);
},
_createSimpleDataGrid: function()
@@ -273,12 +310,6 @@ WebInspector.CookieItemsView.prototype = {
this._dataGrid.children[0].selected = true;
},
- resize: function()
- {
- if (this._dataGrid)
- this._dataGrid.updateWidths();
- },
-
_deleteButtonClicked: function(event)
{
if (!this._dataGrid || !this._dataGrid.selectedNode)
@@ -300,4 +331,5 @@ WebInspector.CookieItemsView.prototype = {
}
}
-WebInspector.CookieItemsView.prototype.__proto__ = WebInspector.View.prototype;
+WebInspector.CookieItemsView.prototype.__proto__ = WebInspector.CookiesTable.prototype;
+
diff --git a/WebCore/inspector/front-end/CookieParser.js b/WebCore/inspector/front-end/CookieParser.js
index 2be5df7..f96be0b 100755
--- a/WebCore/inspector/front-end/CookieParser.js
+++ b/WebCore/inspector/front-end/CookieParser.js
@@ -54,7 +54,7 @@ WebInspector.CookieParser.prototype = {
if (kv.key.charAt(0) === "$" && this._lastCookie)
this._lastCookie.addAttribute(kv.key.slice(1), kv.value);
else if (kv.key.toLowerCase() !== "$version" && typeof kv.value === "string")
- this._addCookie(kv);
+ this._addCookie(kv, WebInspector.Cookie.Type.Request);
this._advanceAndCheckCookieDelimiter();
}
this._flushCookie();
@@ -69,7 +69,7 @@ WebInspector.CookieParser.prototype = {
if (this._lastCookie)
this._lastCookie.addAttribute(kv.key, kv.value);
else
- this._addCookie(kv);
+ this._addCookie(kv, WebInspector.Cookie.Type.Response);
if (this._advanceAndCheckCookieDelimiter())
this._flushCookie();
}
@@ -128,14 +128,14 @@ WebInspector.CookieParser.prototype = {
return match[0].match("\n") !== null;
},
- _addCookie: function(keyValue)
+ _addCookie: function(keyValue, type)
{
if (this._lastCookie)
this._lastCookie.size = keyValue.position - this._lastCookiePosition;
- // Mozilla bug 169091: Mozilla, IE and Chrome treat signle token (w/o "=") as
+ // Mozilla bug 169091: Mozilla, IE and Chrome treat single token (w/o "=") as
// specifying a value for a cookie with empty name.
- this._lastCookie = keyValue.value ? new WebInspector.Cookie(keyValue.key, keyValue.value) :
- new WebInspector.Cookie("", keyValue.key);
+ this._lastCookie = keyValue.value ? new WebInspector.Cookie(keyValue.key, keyValue.value, type) :
+ new WebInspector.Cookie("", keyValue.key, type);
this._lastCookiePosition = keyValue.position;
this._cookies.push(this._lastCookie);
}
@@ -151,10 +151,11 @@ WebInspector.CookieParser.parseSetCookie = function(header)
return (new WebInspector.CookieParser()).parseSetCookie(header);
}
-WebInspector.Cookie = function(name, value)
+WebInspector.Cookie = function(name, value, type)
{
this.name = name;
this.value = value;
+ this.type = type;
this._attributes = {};
}
@@ -202,3 +203,8 @@ WebInspector.Cookie.prototype = {
this._attributes[key.toLowerCase()] = value;
}
}
+
+WebInspector.Cookie.Type = {
+ Request: 0,
+ Response: 1
+};
diff --git a/WebCore/inspector/front-end/DataGrid.js b/WebCore/inspector/front-end/DataGrid.js
index 3007497..bc429d9 100644
--- a/WebCore/inspector/front-end/DataGrid.js
+++ b/WebCore/inspector/front-end/DataGrid.js
@@ -308,7 +308,7 @@ WebInspector.DataGrid.prototype = {
return this._dataTableBody;
},
- autoSizeColumns: function(minPercent, maxPercent)
+ autoSizeColumns: function(minPercent, maxPercent, maxDescentLevel)
{
if (minPercent)
minPercent = Math.min(minPercent, Math.floor(100 / this._columnCount));
@@ -317,8 +317,9 @@ WebInspector.DataGrid.prototype = {
for (var columnIdentifier in columns)
widths[columnIdentifier] = (columns[columnIdentifier].title || "").length;
- for (var i = 0; i < this.children.length; ++i) {
- var node = this.children[i];
+ var children = maxDescentLevel ? this._enumerateChildren(this, [], maxDescentLevel + 1) : this.children;
+ for (var i = 0; i < children.length; ++i) {
+ var node = children[i];
for (var columnIdentifier in columns) {
var text = node.data[columnIdentifier] || "";
if (text.length > widths[columnIdentifier])
@@ -371,6 +372,17 @@ WebInspector.DataGrid.prototype = {
this.updateWidths();
},
+ _enumerateChildren: function(rootNode, result, maxLevel)
+ {
+ if (!rootNode.root)
+ result.push(rootNode);
+ if (!maxLevel)
+ return;
+ for (var i = 0; i < rootNode.children.length; ++i)
+ this._enumerateChildren(rootNode.children[i], result, maxLevel - 1);
+ return result;
+ },
+
// Updates the widths of the table, including the positions of the column
// resizers.
//
@@ -388,7 +400,8 @@ WebInspector.DataGrid.prototype = {
var tableWidth = this._dataTable.offsetWidth;
var numColumns = headerTableColumns.length;
- if (!this._columnWidthsInitialized) {
+ // Do not attempt to use offsetes if we're not attached to the document tree yet.
+ if (!this._columnWidthsInitialized && this.element.offsetWidth) {
// Give all the columns initial widths now so that during a resize,
// when the two columns that get resized get a percent value for
// their widths, all the other columns already have percent values
diff --git a/WebCore/inspector/front-end/FontView.js b/WebCore/inspector/front-end/FontView.js
index b011204..78a7e70 100644
--- a/WebCore/inspector/front-end/FontView.js
+++ b/WebCore/inspector/front-end/FontView.js
@@ -69,6 +69,7 @@ WebInspector.FontView.prototype = {
resize: function()
{
this.updateFontPreviewSize();
+ WebInspector.ResourceView.prototype.resize.call(this);
},
updateFontPreviewSize: function()
diff --git a/WebCore/inspector/front-end/ResourceView.js b/WebCore/inspector/front-end/ResourceView.js
index 862569f..ffb229d 100644
--- a/WebCore/inspector/front-end/ResourceView.js
+++ b/WebCore/inspector/front-end/ResourceView.js
@@ -139,14 +139,20 @@ WebInspector.ResourceView.prototype = {
this._selectTab();
},
+ resize: function()
+ {
+ if (this._cookiesView && !this._cookiesView.element.hasStyleClass("hidden"))
+ this._cookiesView.resize();
+ },
+
_selectTab: function()
{
- if (this._headersVisible) {
- if (!this.hasContentTab() || WebInspector.applicationSettings.resourceViewTab === "headers")
- this._selectHeadersTab();
- else
- this.selectContentTab();
- } else
+ var preferredTab = WebInspector.applicationSettings.resourceViewTab;
+ if (this._headersVisible && this._cookiesView && preferredTab === "cookies")
+ this._selectCookiesTab();
+ else if (this._headersVisible && (!this.hasContentTab() || preferredTab === "headers"))
+ this._selectHeadersTab();
+ else
this._innerSelectContentTab();
},
@@ -170,11 +176,18 @@ WebInspector.ResourceView.prototype = {
return false;
},
+ _selectCookiesTab: function(updatePrefs)
+ {
+ if (updatePrefs)
+ WebInspector.applicationSettings.resourceViewTab = "cookies";
+ this.tabbedPane.selectTabById("cookies");
+ this._cookiesView.resize();
+ },
+
_innerSelectContentTab: function()
{
this.tabbedPane.selectTabById("content");
- if ("resize" in this)
- this.resize();
+ this.resize();
if (this.hasContentTab())
this.contentTabSelected();
},
@@ -283,6 +296,7 @@ WebInspector.ResourceView.prototype = {
additionalRow = {header: "(Key3)", value: this.resource.webSocketRequestKey3};
this._refreshHeaders(WebInspector.UIString("Request Headers"), this.resource.sortedRequestHeaders, additionalRow, this.requestHeadersTreeElement);
this._refreshFormData();
+ this._refreshCookies();
},
_refreshResponseHeaders: function()
@@ -291,6 +305,7 @@ WebInspector.ResourceView.prototype = {
if (typeof this.resource.webSocketChallengeResponse !== "undefined")
additionalRow = {header: "(Challenge Response)", value: this.resource.webSocketChallengeResponse};
this._refreshHeaders(WebInspector.UIString("Response Headers"), this.resource.sortedResponseHeaders, additionalRow, this.responseHeadersTreeElement);
+ this._refreshCookies();
},
_refreshHTTPInformation: function()
@@ -347,7 +362,80 @@ WebInspector.ResourceView.prototype = {
headerTreeElement.selectable = false;
headersTreeElement.appendChild(headerTreeElement);
}
+ },
+
+ _refreshCookies: function()
+ {
+ if (!this._cookiesView) {
+ if (!this.resource.requestCookies && !this.resource.responseCookies)
+ return;
+ this._cookiesView = new WebInspector.ResourceCookiesTab();
+ this.tabbedPane.appendTab("cookies", WebInspector.UIString("Cookies"), this._cookiesView.element, this._selectCookiesTab.bind(this, true));
+ }
+ this._cookiesView.requestCookies = this.resource.requestCookies;
+ this._cookiesView.responseCookies = this.resource.responseCookies;
}
}
WebInspector.ResourceView.prototype.__proto__ = WebInspector.View.prototype;
+
+WebInspector.ResourceCookiesTab = function()
+{
+ WebInspector.CookiesTable.call(this);
+ this.element.addStyleClass("resource-view-cookies");
+ this._requestCookies = [];
+ this._responseCookies = [];
+ this._createDataGrid(true);
+ this._requestCookiesNode = this._createFolder(WebInspector.UIString("Request Cookies"));
+ this._responseCookiesNode = this._createFolder(WebInspector.UIString("Response Cookies"));
+}
+
+WebInspector.ResourceCookiesTab.prototype = {
+ set requestCookies(cookies)
+ {
+ if (this._requestCookies === cookies)
+ return;
+ this._requestCookies = cookies;
+ this._populateCookies(this._requestCookiesNode, this._requestCookies);
+ },
+
+ set responseCookies(cookies)
+ {
+ if (this._responseCookies === cookies)
+ return;
+ this._responseCookies = cookies;
+ this._populateCookies(this._responseCookiesNode, this._responseCookies);
+ },
+
+ _populateDataGrid: function()
+ {
+ this._populateCookies(this._requestCookiesNode, this._requestCookies);
+ this._populateCookies(this._responseCookiesNode, this._responseCookies);
+ },
+
+ _populateCookies: function(parentNode, cookies)
+ {
+ WebInspector.CookiesTable.prototype._populateCookies.call(this, parentNode, cookies);
+ var totalSize = 0;
+ if (cookies) {
+ for (var i = 0; i < cookies.length; ++i)
+ totalSize += cookies[i].size;
+ }
+ parentNode.expanded = true;
+ parentNode.data[5] = totalSize;
+ parentNode.refresh();
+ },
+
+ _createFolder: function(name)
+ {
+ var data = [ name, "", "", "", "", 0, "", "" ];
+ var node = new WebInspector.DataGridNode(data);
+ node.selectable = true;
+ node.expanded = true;
+ this._dataGrid.appendChild(node);
+ node.element.addStyleClass("row-group");
+ return node;
+ }
+};
+
+WebInspector.ResourceCookiesTab.prototype.__proto__ = WebInspector.CookiesTable.prototype;
diff --git a/WebCore/inspector/front-end/SourceView.js b/WebCore/inspector/front-end/SourceView.js
index 8f024bc..bfdc058 100644
--- a/WebCore/inspector/front-end/SourceView.js
+++ b/WebCore/inspector/front-end/SourceView.js
@@ -73,6 +73,7 @@ WebInspector.SourceView.prototype = {
this.sourceFrame.resize();
if (this.localSourceFrame)
this.localSourceFrame.resize();
+ WebInspector.ResourceView.prototype.resize.call(this);
},
setupSourceFrameIfNeeded: function()
diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css
index ab59fb8..429e749 100644
--- a/WebCore/inspector/front-end/inspector.css
+++ b/WebCore/inspector/front-end/inspector.css
@@ -898,6 +898,29 @@ body.platform-linux .monospace, body.platform-linux .source-code {
top: 20px;
}
+.resource-view .resource-view-cookies {
+ position: absolute;
+ top: 0;
+ right: 0;
+ left: 0;
+ bottom: 0;
+ overflow: auto;
+ padding: 12px;
+}
+
+.resource-view.headers-visible .resource-view-cookies {
+ top: 20px;
+}
+
+.resource-view-cookies.table .data-grid {
+ height: 100%;
+}
+
+.resource-view-cookies .data-grid .row-group {
+ font-weight: bold;
+ font-size: 11px;
+}
+
.webkit-line-gutter-backdrop {
/* Keep this in sync with view-source.css (.webkit-line-gutter-backdrop) */
width: 31px;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list