Title: [141417] trunk/Source/WebCore
Revision
141417
Author
[email protected]
Date
2013-01-31 06:52:58 -0800 (Thu, 31 Jan 2013)

Log Message

Web Inspector: [Network] Add cookie column to show presence of request/response cookies.
https://bugs.webkit.org/show_bug.cgi?id=107441

Patch by Eugene Klyuchnikov <[email protected]> on 2013-01-31
Reviewed by Pavel Feldman.

In some use cases only responses that contain "set-cookie" headers
are interesting.

* English.lproj/localizedStrings.js: Added "Set-Cookies" string.
* inspector/front-end/NetworkPanel.js:
(WebInspector.NetworkLogView.prototype._createTable): Added columns.
(WebInspector.NetworkLogView.prototype._createSortingFunctions): Ditto.
(WebInspector.NetworkDataGridNode.prototype.createCells): Ditto.
(WebInspector.NetworkDataGridNode.prototype.refreshRequest): Ditto.
(WebInspector.NetworkDataGridNode.prototype._refreshCookiesCell): Added.
(WebInspector.NetworkDataGridNode.prototype._refreshSetCookiesCell): Added.
(WebInspector.NetworkDataGridNode.RequestCookiesCountComparator): Added.
(WebInspector.NetworkDataGridNode.ResponseCookiesCountComparator): Added.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (141416 => 141417)


--- trunk/Source/WebCore/ChangeLog	2013-01-31 14:30:49 UTC (rev 141416)
+++ trunk/Source/WebCore/ChangeLog	2013-01-31 14:52:58 UTC (rev 141417)
@@ -1,3 +1,24 @@
+2013-01-31  Eugene Klyuchnikov  <[email protected]>
+
+        Web Inspector: [Network] Add cookie column to show presence of request/response cookies.
+        https://bugs.webkit.org/show_bug.cgi?id=107441
+
+        Reviewed by Pavel Feldman.
+
+        In some use cases only responses that contain "set-cookie" headers
+        are interesting.
+
+        * English.lproj/localizedStrings.js: Added "Set-Cookies" string.
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkLogView.prototype._createTable): Added columns.
+        (WebInspector.NetworkLogView.prototype._createSortingFunctions): Ditto.
+        (WebInspector.NetworkDataGridNode.prototype.createCells): Ditto.
+        (WebInspector.NetworkDataGridNode.prototype.refreshRequest): Ditto.
+        (WebInspector.NetworkDataGridNode.prototype._refreshCookiesCell): Added.
+        (WebInspector.NetworkDataGridNode.prototype._refreshSetCookiesCell): Added.
+        (WebInspector.NetworkDataGridNode.RequestCookiesCountComparator): Added.
+        (WebInspector.NetworkDataGridNode.ResponseCookiesCountComparator): Added.
+
 2013-01-31  Andrey Adaikin  <[email protected]>
 
         Web Inspector: Exception in HeapSnapshotView.js

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js (141416 => 141417)


--- trunk/Source/WebCore/English.lproj/localizedStrings.js	2013-01-31 14:30:49 UTC (rev 141416)
+++ trunk/Source/WebCore/English.lproj/localizedStrings.js	2013-01-31 14:52:58 UTC (rev 141417)
@@ -394,6 +394,7 @@
 localizedStrings["Latency"] = "Latency";
 localizedStrings["Lon = "] = "Lon = ";
 localizedStrings["Response Time"] = "Response Time";
+localizedStrings["Set-Cookies"] = "Set-Cookies";
 localizedStrings["Start"] = "Start";
 localizedStrings["Start CPU profiling."] = "Start CPU profiling.";
 localizedStrings["Start CSS selector profiling."] = "Start CSS selector profiling.";

Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (141416 => 141417)


--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2013-01-31 14:30:49 UTC (rev 141416)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2013-01-31 14:52:58 UTC (rev 141417)
@@ -95,7 +95,7 @@
     WebInspector.networkLog.requests.forEach(this._appendRequest.bind(this));
 }
 
-WebInspector.NetworkLogView._defaultColumnsVisivility = {method: true, status: true, domain: false, type: true, initiator: true, size: true, time: true};
+WebInspector.NetworkLogView._defaultColumnsVisivility = {method: true, status: true, domain: false, type: true, initiator: true, cookies: false, setCookies: false, size: true, time: true};
 
 WebInspector.NetworkLogView.prototype = {
     _initializeView: function()
@@ -157,7 +157,7 @@
 
     _createTable: function()
     {
-        var columns = {name: {}, method: {}, status: {}, domain: {}, type: {}, initiator: {}, size: {}, time: {}, timeline: {}};
+        var columns = {name: {}, method: {}, status: {}, domain: {}, type: {}, initiator: {}, cookies: {}, setCookies: {}, size: {}, time: {}, timeline: {}};
 
         columns.name.titleDOMFragment = this._makeHeaderFragment(WebInspector.UIString("Name"), WebInspector.UIString("Path"));
         columns.name.name = WebInspector.UIString("Name");
@@ -186,6 +186,16 @@
         columns.initiator.sortable = true;
         columns.initiator.weight = 10;
 
+        columns.cookies.title = WebInspector.UIString("Cookies");
+        columns.cookies.sortable = true;
+        columns.cookies.weight = 6;
+        columns.cookies.aligned = "right";
+
+        columns.setCookies.title = WebInspector.UIString("Set-Cookies");
+        columns.setCookies.sortable = true;
+        columns.setCookies.weight = 6;
+        columns.setCookies.aligned = "right";
+
         columns.size.titleDOMFragment = this._makeHeaderFragment(WebInspector.UIString("Size"), WebInspector.UIString("Content"));
         columns.size.name = WebInspector.UIString("Size");
         columns.size.sortable = true;
@@ -280,6 +290,8 @@
         this._sortingFunctions.domain = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "domain", false);
         this._sortingFunctions.type = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "mimeType", false);
         this._sortingFunctions.initiator = WebInspector.NetworkDataGridNode.InitiatorComparator;
+        this._sortingFunctions.cookies = WebInspector.NetworkDataGridNode.RequestCookiesCountComparator;
+        this._sortingFunctions.setCookies = WebInspector.NetworkDataGridNode.ResponseCookiesCountComparator;
         this._sortingFunctions.size = WebInspector.NetworkDataGridNode.SizeComparator;
         this._sortingFunctions.time = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "duration", false);
         this._sortingFunctions.timeline = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "startTime", false);
@@ -1961,6 +1973,8 @@
         this._domainCell = this._createDivInTD("domain");
         this._typeCell = this._createDivInTD("type");
         this._initiatorCell = this._createDivInTD("initiator");
+        this._cookiesCell = this._createDivInTD("cookies");
+        this._setCookiesCell = this._createDivInTD("setCookies");
         this._sizeCell = this._createDivInTD("size");
         this._timeCell = this._createDivInTD("time");
         this._createTimelineCell();
@@ -2067,6 +2081,8 @@
         this._refreshDomainCell();
         this._refreshTypeCell();
         this._refreshInitiatorCell();
+        this._refreshCookiesCell();
+        this._refreshSetCookiesCell();
         this._refreshSizeCell();
         this._refreshTimeCell();
 
@@ -2212,6 +2228,18 @@
         }
     },
 
+    _refreshCookiesCell: function()
+    {
+        var requestCookies = this._request.requestCookies;
+        this._cookiesCell.setTextAndTitle(requestCookies ? "" + requestCookies.length : "");
+    },
+
+    _refreshSetCookiesCell: function()
+    {
+        var responseCookies = this._request.responseCookies;
+        this._setCookiesCell.setTextAndTitle(responseCookies ? "" + responseCookies.length : "");
+    },
+
     _refreshSizeCell: function()
     {
         if (this._request.cached) {
@@ -2382,6 +2410,20 @@
     return a._request.initiator.lineNumber - b._request.initiator.lineNumber;
 }
 
+WebInspector.NetworkDataGridNode.RequestCookiesCountComparator = function(a, b)
+{
+    var aScore = a._request.requestCookies ? a._request.requestCookies.length : 0;
+    var bScore = b._request.requestCookies ? b._request.requestCookies.length : 0;
+    return aScore - bScore;
+}
+
+WebInspector.NetworkDataGridNode.ResponseCookiesCountComparator = function(a, b)
+{
+    var aScore = a._request.responseCookies ? a._request.responseCookies.length : 0;
+    var bScore = b._request.responseCookies ? b._request.responseCookies.length : 0;
+    return aScore - bScore;
+}
+
 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyName, revert, a, b)
 {
     var aValue = a._request[propertyName];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to