From 91f91182b375af99292c61f966a8743050ef22a6 Mon Sep 17 00:00:00 2001 From: Jan Odvarko Date: Wed, 11 Nov 2015 14:41:05 +0100 Subject: [PATCH] Bug 1221754 - Set bodySize to 0 in case of 304 responses; r=jryans --- devtools/client/netmonitor/har/har-builder.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/devtools/client/netmonitor/har/har-builder.js b/devtools/client/netmonitor/har/har-builder.js index ecc52e4c4cb..0339cb59c90 100644 --- a/devtools/client/netmonitor/har/har-builder.js +++ b/devtools/client/netmonitor/har/har-builder.js @@ -298,7 +298,15 @@ HarBuilder.prototype = { response.redirectURL = findValue(headers, "Location"); response.headersSize = headersSize; - response.bodySize = file.transferredSize || -1; + + // 'bodySize' is size of the received response body in bytes. + // Set to zero in case of responses coming from the cache (304). + // Set to -1 if the info is not available. + if (typeof file.transferredSize != "number") { + response.bodySize = (response.status == 304) ? 0 : -1; + } else { + response.bodySize = file.transferredSize; + } return response; },