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):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105619
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-01-23 Andrey Kosyakov <caseq@chromium.org>
+
+ 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 <msanchez@igalia.com>
[GTK] Refactor GTK's accessibilitity code to be more modular
*/
get responseBodySize()
{
+ if (this._resource.cached || this._resource.statusCode === 304)
+ return 0;
return this._resource.transferSize - this._resource.responseHeadersSize
},
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)
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)
_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"));
},
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) {}