Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Unified Diff: Source/devtools/front_end/NetworkRequest.js

Issue 156623005: Add transfer size paramater to didFinishLoading [3/3] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/NetworkRequest.js
diff --git a/Source/devtools/front_end/NetworkRequest.js b/Source/devtools/front_end/NetworkRequest.js
index 066e6d2b5660c4ff0bbfab0230efbb9c8e389e67..4301d75264d69154d793ddf6972a41c64fdb76f8 100644
--- a/Source/devtools/front_end/NetworkRequest.js
+++ b/Source/devtools/front_end/NetworkRequest.js
@@ -250,24 +250,7 @@ WebInspector.NetworkRequest.prototype = {
*/
get transferSize()
{
- if (typeof this._transferSize === "number")
- return this._transferSize;
- if (this.statusCode === 304) // Not modified
- return this.responseHeadersSize;
- if (this._cached)
- return 0;
- // If we did not receive actual transfer size from network
- // stack, we prefer using Content-Length over resourceSize as
- // resourceSize may differ from actual transfer size if platform's
- // network stack performed decoding (e.g. gzip decompression).
- // The Content-Length, though, is expected to come from raw
- // response headers and will reflect actual transfer length.
- // This won't work for chunked content encoding, so fall back to
- // resourceSize when we don't have Content-Length. This still won't
- // work for chunks with non-trivial encodings. We need a way to
- // get actual transfer size from the network stack.
- var bodySize = Number(this.responseHeaderValue("Content-Length") || this.resourceSize);
- return this.responseHeadersSize + bodySize;
+ return this._transferSize || 0;
},
/**
@@ -279,6 +262,14 @@ WebInspector.NetworkRequest.prototype = {
},
/**
+ * @param {number} x
+ */
+ setTransferSize: function(x)
+ {
+ this._transferSize = x;
+ },
+
+ /**
* @return {boolean}
*/
get finished()

Powered by Google App Engine
This is Rietveld 408576698