Title: [105619] trunk/Source/WebCore
Revision
105619
Author
[email protected]
Date
2012-01-23 06:52:50 -0800 (Mon, 23 Jan 2012)

Log Message

Web Inspector: response.bodySize in HAR is invalid (negative) for cached resources
https://bugs.webkit.org/show_bug.cgi?id=76823

Reviewed by Yury Semikhatsky.

- fix response.bodySize for cached resources;
Also some drive-by fixes:
- pretty-print HAR when exported
- proper annotation for JSON.stringify()
- de-obfuscate a piece of code in TimelinePanel

* inspector/front-end/HAREntry.js:
(WebInspector.HAREntry.prototype.get responseBodySize):
* inspector/front-end/NetworkPanel.js:
(WebInspector.NetworkLogView.prototype._exportAll):
(WebInspector.NetworkLogView.prototype._exportResource):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (105618 => 105619)


--- trunk/Source/WebCore/ChangeLog	2012-01-23 14:45:23 UTC (rev 105618)
+++ trunk/Source/WebCore/ChangeLog	2012-01-23 14:52:50 UTC (rev 105619)
@@ -1,3 +1,22 @@
+2012-01-23  Andrey Kosyakov  <[email protected]>
+
+        Web Inspector: response.bodySize in HAR is invalid (negative) for cached resources
+        https://bugs.webkit.org/show_bug.cgi?id=76823
+
+        Reviewed by Yury Semikhatsky.
+
+        - fix response.bodySize for cached resources;
+        Also some drive-by fixes:
+        - pretty-print HAR when exported
+        - proper annotation for JSON.stringify()
+        - de-obfuscate a piece of code in TimelinePanel
+
+        * inspector/front-end/HAREntry.js:
+        (WebInspector.HAREntry.prototype.get responseBodySize):
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkLogView.prototype._exportAll):
+        (WebInspector.NetworkLogView.prototype._exportResource):
+
 2012-01-23  Mario Sanchez Prada  <[email protected]>
 
         [GTK] Refactor GTK's accessibilitity code to be more modular

Modified: trunk/Source/WebCore/inspector/front-end/HAREntry.js (105618 => 105619)


--- trunk/Source/WebCore/inspector/front-end/HAREntry.js	2012-01-23 14:45:23 UTC (rev 105618)
+++ trunk/Source/WebCore/inspector/front-end/HAREntry.js	2012-01-23 14:52:50 UTC (rev 105619)
@@ -250,6 +250,8 @@
      */
     get responseBodySize()
     {
+        if (this._resource.cached || this._resource.statusCode === 304)
+            return 0;
         return this._resource.transferSize - this._resource.responseHeadersSize
     },
 

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


--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2012-01-23 14:45:23 UTC (rev 105618)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2012-01-23 14:52:50 UTC (rev 105619)
@@ -964,13 +964,13 @@
         var harArchive = {
             log: (new WebInspector.HARLog(this._resources)).build()
         };
-        InspectorFrontendHost.copyText(JSON.stringify(harArchive));
+        InspectorFrontendHost.copyText(JSON.stringify(harArchive, null, 2));
     },
 
     _copyResource: function(resource)
     {
         var har = (new WebInspector.HAREntry(resource)).build();
-        InspectorFrontendHost.copyText(JSON.stringify(har));
+        InspectorFrontendHost.copyText(JSON.stringify(har, null, 2));
     },
 
     _copyLocation: function(resource)
@@ -994,13 +994,13 @@
             log: (new WebInspector.HARLog(this._resources)).build()
         };
         
-        InspectorFrontendHost.saveAs(WebInspector.inspectedPageDomain + ".har", JSON.stringify(harArchive));
+        InspectorFrontendHost.saveAs(WebInspector.inspectedPageDomain + ".har", JSON.stringify(harArchive, null, 2));
     },
 
     _exportResource: function(resource)
     {
         var har = (new WebInspector.HAREntry(resource)).build();
-        InspectorFrontendHost.saveAs(resource.displayName + ".har", JSON.stringify(har));
+        InspectorFrontendHost.saveAs(resource.displayName + ".har", JSON.stringify(har, null, 2));
     },
 
     _clearBrowserCache: function(event)

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePanel.js (105618 => 105619)


--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2012-01-23 14:45:23 UTC (rev 105618)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2012-01-23 14:52:50 UTC (rev 105619)
@@ -1391,12 +1391,13 @@
 
     _saveToFile: function()
     {
-        var records = ['[' + JSON.stringify(window.navigator.appVersion)];
+        var records = ['[' + JSON.stringify(new String(window.navigator.appVersion))];
         for (var i = 0; i < this._records.length; ++i)
             records.push(JSON.stringify(this._records[i]));
-            records[records.length - 1] = records[records.length - 1] + "]";
 
-        var now= new Date();
+        records[records.length - 1] = records[records.length - 1] + "]";
+
+        var now = new Date();
         var suggestedFileName = "TimelineRawData-" + now.toISO8601Compact() + ".json";
         InspectorFrontendHost.saveAs(suggestedFileName, records.join(",\n"));
     },

Modified: trunk/Source/WebCore/inspector/front-end/externs.js (105618 => 105619)


--- trunk/Source/WebCore/inspector/front-end/externs.js	2012-01-23 14:45:23 UTC (rev 105618)
+++ trunk/Source/WebCore/inspector/front-end/externs.js	2012-01-23 14:52:50 UTC (rev 105619)
@@ -41,9 +41,13 @@
 var JSON = {}
 /** @param {string} str */
 JSON.parse = function(str) {}
-/** @param {Object} obj */
-/** @return {string} */
-JSON.stringify = function(str) {}
+/**
+ * @param {Object} obj
+ * @param {Function=} replacer
+ * @param {number=} space
+ * @return {string}
+ */
+JSON.stringify = function(obj, replacer, space) {}
 
 /** @param {boolean=} param */
 Element.prototype.scrollIntoViewIfNeeded = function(param) {}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to