Bug 1382025 - Include the headers size in the netmonitor 'Transferred' column; r=tromey
authorVincent Lequertier <vi.le@autistici.org>
Sun, 30 Jul 2017 11:42:26 +0200
changeset 373391 448569fa56e550ce4cb71ae63c090227af71ecf3
parent 373390 4c4c732eef949cb4cc34b8e6f10e04830ca9b73e
child 373392 da2bc55ad33a418547f7776cf761cbef0c93c0ae
push id48242
push userttromey@mozilla.com
push dateTue, 08 Aug 2017 13:39:01 +0000
treeherderautoland@448569fa56e5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstromey
bugs1382025
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1382025 - Include the headers size in the netmonitor 'Transferred' column; r=tromey MozReview-Commit-ID: 4LfbqvxLsqi
devtools/client/netmonitor/test/browser_net_brotli.js
devtools/client/netmonitor/test/browser_net_content-type.js
devtools/client/netmonitor/test/browser_net_filter-flags.js
devtools/client/netmonitor/test/browser_net_simple-request-data.js
devtools/client/netmonitor/test/browser_net_sort-01.js
devtools/client/netmonitor/test/browser_net_sort-02.js
devtools/shared/webconsole/network-monitor.js
--- a/devtools/client/netmonitor/test/browser_net_brotli.js
+++ b/devtools/client/netmonitor/test/browser_net_brotli.js
@@ -35,17 +35,17 @@ add_task(function* () {
     document,
     getDisplayedRequests(store.getState()),
     getSortedRequests(store.getState()).get(0),
     "GET", HTTPS_CONTENT_TYPE_SJS + "?fmt=br", {
       status: 200,
       statusText: "Connected",
       type: "plain",
       fullMimeType: "text/plain",
-      transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 10),
+      transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 60),
       size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 64),
       time: true
     });
 
   wait = waitForDOM(document, ".CodeMirror-code");
   EventUtils.sendMouseEvent({ type: "click" },
     document.querySelector(".network-details-panel-toggle"));
   EventUtils.sendMouseEvent({ type: "click" },
--- a/devtools/client/netmonitor/test/browser_net_content-type.js
+++ b/devtools/client/netmonitor/test/browser_net_content-type.js
@@ -124,17 +124,17 @@ add_task(function* () {
     getSortedRequests(store.getState()).get(6),
     "GET",
     CONTENT_TYPE_SJS + "?fmt=gzip",
     {
       status: 200,
       statusText: "OK",
       type: "plain",
       fullMimeType: "text/plain",
-      transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 73),
+      transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 324),
       size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 10.73),
       time: true
     }
   );
 
   yield selectIndexAndWaitForSourceEditor(0);
   yield testResponseTab("xml");
 
--- a/devtools/client/netmonitor/test/browser_net_filter-flags.js
+++ b/devtools/client/netmonitor/test/browser_net_filter-flags.js
@@ -251,24 +251,24 @@ add_task(function* () {
   setFreetextFilter("size:10989");
   testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]);
 
   // Testing the upper bound
   setFreetextFilter("size:11.804k");
   testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]);
 
   // Test transferred
-  setFreetextFilter("transferred:0");
-  testContents([0, 0, 0, 0, 1, 1, 1, 1, 0, 1]);
+  setFreetextFilter("transferred:200");
+  testContents([0, 0, 0, 0, 1, 1, 1, 1, 0, 0]);
 
-  setFreetextFilter("transferred:1");
-  testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
+  setFreetextFilter("transferred:234");
+  testContents([1, 0, 1, 0, 0, 0, 0, 0, 0, 1]);
 
-  setFreetextFilter("transferred:34");
-  testContents([0, 0, 1, 1, 0, 0, 0, 0, 0, 0]);
+  setFreetextFilter("transferred:248");
+  testContents([0, 0, 1, 1, 0, 0, 0, 0, 0, 1]);
 
   // Test larger-than
   setFreetextFilter("larger-than:-1");
   testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
 
   setFreetextFilter("larger-than:0");
   testContents([1, 1, 1, 1, 0, 0, 0, 0, 1, 0]);
 
@@ -283,24 +283,24 @@ add_task(function* () {
 
   setFreetextFilter("larger-than:10.732k");
   testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
 
   // Test transferred-larger-than
   setFreetextFilter("transferred-larger-than:-1");
   testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
 
-  setFreetextFilter("transferred-larger-than:0");
-  testContents([1, 1, 1, 1, 0, 0, 0, 0, 1, 0]);
+  setFreetextFilter("transferred-larger-than:214");
+  testContents([1, 1, 1, 1, 0, 0, 0, 0, 1, 1]);
 
-  setFreetextFilter("transferred-larger-than:33");
-  testContents([0, 0, 1, 1, 0, 0, 0, 0, 1, 0]);
+  setFreetextFilter("transferred-larger-than:247");
+  testContents([0, 1, 1, 1, 0, 0, 0, 0, 1, 0]);
 
-  setFreetextFilter("transferred-larger-than:34");
-  testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]);
+  setFreetextFilter("transferred-larger-than:248");
+  testContents([0, 1, 0, 1, 0, 0, 0, 0, 1, 0]);
 
   setFreetextFilter("transferred-larger-than:10.73k");
   testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
 
   // Test cause
   setFreetextFilter("cause:xhr");
   testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
 
--- a/devtools/client/netmonitor/test/browser_net_simple-request-data.js
+++ b/devtools/client/netmonitor/test/browser_net_simple-request-data.js
@@ -251,17 +251,17 @@ function test() {
                requestItem.transferredSize &&
                requestItem.contentSize &&
                requestItem.mimeType &&
                requestItem.responseContent;
       });
 
       let requestItem = getSortedRequests(store.getState()).get(0);
 
-      is(requestItem.transferredSize, "12",
+      is(requestItem.transferredSize, "342",
         "The transferredSize data has an incorrect value.");
       is(requestItem.contentSize, "12",
         "The contentSize data has an incorrect value.");
       is(requestItem.mimeType, "text/plain; charset=utf-8",
         "The mimeType data has an incorrect value.");
 
       ok(requestItem.responseContent,
         "There should be a responseContent data available.");
@@ -282,17 +282,17 @@ function test() {
         document,
         getDisplayedRequests(store.getState()),
         requestItem,
         "GET",
         SIMPLE_SJS,
         {
           type: "plain",
           fullMimeType: "text/plain; charset=utf-8",
-          transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 12),
+          transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 342),
           size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 12),
         }
       );
     });
 
     expectEvent(EVENTS.UPDATING_EVENT_TIMINGS, async () => {
       await waitUntil(() => {
         let requestItem = getSortedRequests(store.getState()).get(0);
--- a/devtools/client/netmonitor/test/browser_net_sort-01.js
+++ b/devtools/client/netmonitor/test/browser_net_sort-01.js
@@ -162,79 +162,79 @@ add_task(function* () {
         getDisplayedRequests(store.getState()),
         getSortedRequests(store.getState()).get(order[i]),
         "GET1", SORTING_SJS + "?index=1", {
           fuzzyUrl: true,
           status: 101,
           statusText: "Meh",
           type: "1",
           fullMimeType: "text/1",
-          transferred: L10N.getStr("networkMenu.sizeUnavailable"),
+          transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 198),
           size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 0),
           time: true
         });
     }
     for (let i = 0, len = order.length / 5; i < len; i++) {
       verifyRequestItemTarget(
         document,
         getDisplayedRequests(store.getState()),
         getSortedRequests(store.getState()).get(order[i + len]),
         "GET2", SORTING_SJS + "?index=2", {
           fuzzyUrl: true,
           status: 200,
           statusText: "Meh",
           type: "2",
           fullMimeType: "text/2",
-          transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 19),
+          transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 217),
           size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 19),
           time: true
         });
     }
     for (let i = 0, len = order.length / 5; i < len; i++) {
       verifyRequestItemTarget(
         document,
         getDisplayedRequests(store.getState()),
         getSortedRequests(store.getState()).get(order[i + len * 2]),
         "GET3", SORTING_SJS + "?index=3", {
           fuzzyUrl: true,
           status: 300,
           statusText: "Meh",
           type: "3",
           fullMimeType: "text/3",
-          transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 29),
+          transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 227),
           size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 29),
           time: true
         });
     }
     for (let i = 0, len = order.length / 5; i < len; i++) {
       verifyRequestItemTarget(
         document,
         getDisplayedRequests(store.getState()),
         getSortedRequests(store.getState()).get(order[i + len * 3]),
         "GET4", SORTING_SJS + "?index=4", {
           fuzzyUrl: true,
           status: 400,
           statusText: "Meh",
           type: "4",
           fullMimeType: "text/4",
-          transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 39),
+          transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 237),
           size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 39),
           time: true
         });
     }
     for (let i = 0, len = order.length / 5; i < len; i++) {
       verifyRequestItemTarget(
         document,
         getDisplayedRequests(store.getState()),
         getSortedRequests(store.getState()).get(order[i + len * 4]),
         "GET5", SORTING_SJS + "?index=5", {
           fuzzyUrl: true,
           status: 500,
           statusText: "Meh",
           type: "5",
           fullMimeType: "text/5",
-          transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 49),
+          transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 247),
           size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 49),
           time: true
         });
     }
   }
 });
--- a/devtools/client/netmonitor/test/browser_net_sort-02.js
+++ b/devtools/client/netmonitor/test/browser_net_sort-02.js
@@ -245,70 +245,70 @@ add_task(function* () {
       getDisplayedRequests(store.getState()),
       getSortedRequests(store.getState()).get(a),
       "GET1", SORTING_SJS + "?index=1", {
         fuzzyUrl: true,
         status: 101,
         statusText: "Meh",
         type: "1",
         fullMimeType: "text/1",
-        transferred: L10N.getStr("networkMenu.sizeUnavailable"),
+        transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 198),
         size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 0),
         time: true
       });
     verifyRequestItemTarget(
       document,
       getDisplayedRequests(store.getState()),
       getSortedRequests(store.getState()).get(b),
       "GET2", SORTING_SJS + "?index=2", {
         fuzzyUrl: true,
         status: 200,
         statusText: "Meh",
         type: "2",
         fullMimeType: "text/2",
-        transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 19),
+        transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 217),
         size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 19),
         time: true
       });
     verifyRequestItemTarget(
       document,
       getDisplayedRequests(store.getState()),
       getSortedRequests(store.getState()).get(c),
       "GET3", SORTING_SJS + "?index=3", {
         fuzzyUrl: true,
         status: 300,
         statusText: "Meh",
         type: "3",
         fullMimeType: "text/3",
-        transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 29),
+        transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 227),
         size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 29),
         time: true
       });
     verifyRequestItemTarget(
       document,
       getDisplayedRequests(store.getState()),
       getSortedRequests(store.getState()).get(d),
       "GET4", SORTING_SJS + "?index=4", {
         fuzzyUrl: true,
         status: 400,
         statusText: "Meh",
         type: "4",
         fullMimeType: "text/4",
-        transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 39),
+        transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 237),
         size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 39),
         time: true
       });
     verifyRequestItemTarget(
       document,
       getDisplayedRequests(store.getState()),
       getSortedRequests(store.getState()).get(e),
       "GET5", SORTING_SJS + "?index=5", {
         fuzzyUrl: true,
         status: 500,
         statusText: "Meh",
         type: "5",
         fullMimeType: "text/5",
-        transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 49),
+        transferred: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 247),
         size: L10N.getFormatStrWithNumbers("networkMenu.sizeB", 49),
         time: true
       });
   }
 });
--- a/devtools/shared/webconsole/network-monitor.js
+++ b/devtools/shared/webconsole/network-monitor.js
@@ -361,17 +361,17 @@ NetworkResponseListener.prototype = {
   receivedData: null,
 
   /**
    * The uncompressed, decoded response body size.
    */
   bodySize: null,
 
   /**
-   * Response body size on the wire, potentially compressed / encoded.
+   * Response size on the wire, potentially compressed / encoded.
    */
   transferredSize: null,
 
   /**
    * The nsIRequest we are started for.
    */
   request: null,
 
@@ -588,17 +588,17 @@ NetworkResponseListener.prototype = {
    */
   _onComplete: function (data) {
     let response = {
       mimeType: "",
       text: data || "",
     };
 
     response.size = this.bodySize;
-    response.transferredSize = this.transferredSize;
+    response.transferredSize = this.transferredSize + this.httpActivity.headersSize;
 
     try {
       response.mimeType = this.request.contentType;
     } catch (ex) {
       // Ignore.
     }
 
     if (!response.mimeType ||
@@ -1332,16 +1332,17 @@ NetworkMonitor.prototype = {
     response.httpVersion = statusLineArray.shift();
     response.remoteAddress = httpActivity.channel.remoteAddress;
     response.remotePort = httpActivity.channel.remotePort;
     response.status = statusLineArray.shift();
     response.statusText = statusLineArray.join(" ");
     response.headersSize = extraStringData.length;
 
     httpActivity.responseStatus = response.status;
+    httpActivity.headersSize = response.headersSize;
 
     // Discard the response body for known response statuses.
     switch (parseInt(response.status, 10)) {
       case HTTP_MOVED_PERMANENTLY:
       case HTTP_FOUND:
       case HTTP_SEE_OTHER:
       case HTTP_TEMPORARY_REDIRECT:
         httpActivity.discardResponseBody = true;