Bug 859221 - [netmonitor] Sizes are displayed in KB not kb, r=dcamp
authorVictor Porof <vporof@mozilla.com>
Mon, 08 Apr 2013 21:34:45 +0300
changeset 128116 b65e3791e401ebfd8bb1ce5be1b707f789f9d3fe
parent 128115 2779fab6ba584e8cc63b0514dfd569f05422e0d5
child 128117 07aae4e9a66ae9b1fb32eb5077487ab4cb83d3c2
push id24521
push userryanvm@gmail.com
push dateTue, 09 Apr 2013 18:31:04 +0000
treeherdermozilla-central@9d5f05a6d497 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdcamp
bugs859221
milestone23.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 859221 - [netmonitor] Sizes are displayed in KB not kb, r=dcamp
browser/devtools/netmonitor/netmonitor-view.js
browser/devtools/netmonitor/test/browser_net_content-type.js
browser/devtools/netmonitor/test/browser_net_post-data.js
browser/devtools/netmonitor/test/browser_net_prefs-and-l10n.js
browser/devtools/netmonitor/test/browser_net_simple-request-data.js
browser/devtools/netmonitor/test/browser_net_simple-request-details.js
browser/devtools/netmonitor/test/browser_net_status-codes.js
browser/locales/en-US/chrome/browser/devtools/netmonitor.properties
--- a/browser/devtools/netmonitor/netmonitor-view.js
+++ b/browser/devtools/netmonitor/netmonitor-view.js
@@ -487,28 +487,28 @@ create({ constructor: RequestsMenuView, 
       case "status": {
         let node = $(".requests-menu-status", aItem.target);
         node.setAttribute("code", aValue);
         break;
       }
       case "contentSize": {
         let size = (aValue / 1024).toFixed(CONTENT_SIZE_DECIMALS);
         let node = $(".requests-menu-size", aItem.target);
-        node.setAttribute("value", L10N.getFormatStr("networkMenu.size", size));
+        node.setAttribute("value", L10N.getFormatStr("networkMenu.sizeKB", size));
         break;
       }
       case "mimeType": {
         let type = aValue.split(";")[0].split("/")[1] || "?";
         let node = $(".requests-menu-type", aItem.target);
         node.setAttribute("value", CONTENT_MIME_TYPE_ABBREVIATIONS[type] || type);
         break;
       }
       case "totalTime": {
         let node = $(".requests-menu-timings-total", aItem.target);
-        node.setAttribute("value", L10N.getFormatStr("networkMenu.total", aValue));
+        node.setAttribute("value", L10N.getFormatStr("networkMenu.totalMS", aValue));
         break;
       }
     }
   },
 
   /**
    * Creates a waterfall representing timing information in a network request item view.
    *
@@ -853,17 +853,17 @@ create({ constructor: NetworkDetailsView
    *
    * @param string aName
    *        The type of headers to populate (request or response).
    * @param object aResponse
    *        The message received from the server.
    */
   _addHeaders: function NVND__addHeaders(aName, aResponse) {
     let kb = (aResponse.headersSize / 1024).toFixed(HEADERS_SIZE_DECIMALS);
-    let size = L10N.getFormatStr("networkMenu.size", kb);
+    let size = L10N.getFormatStr("networkMenu.sizeKB", kb);
     let headersScope = this._headers.addScope(aName + " (" + size + ")");
     headersScope.expanded = true;
 
     for (let header of aResponse.headers) {
       let headerVar = headersScope.addVar(header.name, { null: true }, true);
       headerVar.setGrip(header.value);
     }
   },
@@ -1078,42 +1078,42 @@ create({ constructor: NetworkDetailsView
 
     let tabboxWidth = $("#details-pane").getAttribute("width");
     let availableWidth = tabboxWidth / 2; // Other nodes also take some space.
     let scale = Math.max(availableWidth / aResponse.totalTime, 0);
 
     $("#timings-summary-blocked .requests-menu-timings-box")
       .setAttribute("width", blocked * scale);
     $("#timings-summary-blocked .requests-menu-timings-total")
-      .setAttribute("value", L10N.getFormatStr("networkMenu.total", blocked));
+      .setAttribute("value", L10N.getFormatStr("networkMenu.totalMS", blocked));
 
     $("#timings-summary-dns .requests-menu-timings-box")
       .setAttribute("width", dns * scale);
     $("#timings-summary-dns .requests-menu-timings-total")
-      .setAttribute("value", L10N.getFormatStr("networkMenu.total", dns));
+      .setAttribute("value", L10N.getFormatStr("networkMenu.totalMS", dns));
 
     $("#timings-summary-connect .requests-menu-timings-box")
       .setAttribute("width", connect * scale);
     $("#timings-summary-connect .requests-menu-timings-total")
-      .setAttribute("value", L10N.getFormatStr("networkMenu.total", connect));
+      .setAttribute("value", L10N.getFormatStr("networkMenu.totalMS", connect));
 
     $("#timings-summary-send .requests-menu-timings-box")
       .setAttribute("width", send * scale);
     $("#timings-summary-send .requests-menu-timings-total")
-      .setAttribute("value", L10N.getFormatStr("networkMenu.total", send));
+      .setAttribute("value", L10N.getFormatStr("networkMenu.totalMS", send));
 
     $("#timings-summary-wait .requests-menu-timings-box")
       .setAttribute("width", wait * scale);
     $("#timings-summary-wait .requests-menu-timings-total")
-      .setAttribute("value", L10N.getFormatStr("networkMenu.total", wait));
+      .setAttribute("value", L10N.getFormatStr("networkMenu.totalMS", wait));
 
     $("#timings-summary-receive .requests-menu-timings-box")
       .setAttribute("width", receive * scale);
     $("#timings-summary-receive .requests-menu-timings-total")
-      .setAttribute("value", L10N.getFormatStr("networkMenu.total", receive));
+      .setAttribute("value", L10N.getFormatStr("networkMenu.totalMS", receive));
 
     $("#timings-summary-dns .requests-menu-timings-box")
       .style.transform = "translateX(" + (scale * blocked) + "px)";
     $("#timings-summary-connect .requests-menu-timings-box")
       .style.transform = "translateX(" + (scale * (blocked + dns)) + "px)";
     $("#timings-summary-send .requests-menu-timings-box")
       .style.transform = "translateX(" + (scale * (blocked + dns + connect)) + "px)";
     $("#timings-summary-wait .requests-menu-timings-box")
--- a/browser/devtools/netmonitor/test/browser_net_content-type.js
+++ b/browser/devtools/netmonitor/test/browser_net_content-type.js
@@ -4,62 +4,62 @@
 /**
  * Tests if different response content types are handled correctly.
  */
 
 function test() {
   initNetMonitor(CONTENT_TYPE_URL).then(([aTab, aDebuggee, aMonitor]) => {
     info("Starting test... ");
 
-    let { document, SourceEditor, NetMonitorView } = aMonitor.panelWin;
+    let { document, L10N, SourceEditor, NetMonitorView } = aMonitor.panelWin;
     let { RequestsMenu } = NetMonitorView;
 
     RequestsMenu.lazyUpdate = false;
 
     waitForNetworkEvents(aMonitor, 6).then(() => {
       verifyRequestItemTarget(RequestsMenu.getItemAtIndex(0),
         "GET", CONTENT_TYPE_SJS + "?fmt=xml", {
           status: 200,
           type: "xml",
-          size: "0.04kb",
+          size: L10N.getFormatStr("networkMenu.sizeKB", 0.04),
           time: true
         });
       verifyRequestItemTarget(RequestsMenu.getItemAtIndex(1),
         "GET", CONTENT_TYPE_SJS + "?fmt=css", {
           status: 200,
           type: "css",
-          size: "0.03kb",
+          size: L10N.getFormatStr("networkMenu.sizeKB", 0.03),
           time: true
         });
       verifyRequestItemTarget(RequestsMenu.getItemAtIndex(2),
         "GET", CONTENT_TYPE_SJS + "?fmt=js", {
           status: 200,
           type: "js",
-          size: "0.03kb",
+          size: L10N.getFormatStr("networkMenu.sizeKB", 0.03),
           time: true
         });
       verifyRequestItemTarget(RequestsMenu.getItemAtIndex(3),
         "GET", CONTENT_TYPE_SJS + "?fmt=json", {
           status: 200,
           type: "json",
-          size: "0.03kb",
+          size: L10N.getFormatStr("networkMenu.sizeKB", 0.03),
           time: true
         });
       verifyRequestItemTarget(RequestsMenu.getItemAtIndex(4),
         "GET", CONTENT_TYPE_SJS + "?fmt=bogus", {
           status: 404,
           type: "html",
-          size: "0.02kb",
+          size: L10N.getFormatStr("networkMenu.sizeKB", 0.02),
           time: true
         });
       verifyRequestItemTarget(RequestsMenu.getItemAtIndex(5),
         "GET", TEST_IMAGE, {
           status: 200,
           type: "png",
-          size: "0.76kb",
+          size: L10N.getFormatStr("networkMenu.sizeKB", 0.76),
           time: true
         });
 
       EventUtils.sendMouseEvent({ type: "mousedown" },
         document.getElementById("details-pane-toggle"));
       EventUtils.sendMouseEvent({ type: "mousedown" },
         document.querySelectorAll("#details-pane tab")[3]);
 
--- a/browser/devtools/netmonitor/test/browser_net_post-data.js
+++ b/browser/devtools/netmonitor/test/browser_net_post-data.js
@@ -15,24 +15,24 @@ function test() {
     RequestsMenu.lazyUpdate = false;
     NetworkDetails._params.lazyEmpty = false;
 
     waitForNetworkEvents(aMonitor, 0, 2).then(() => {
       verifyRequestItemTarget(RequestsMenu.getItemAtIndex(0),
         "POST", SIMPLE_SJS + "?foo=bar&baz=42&type=urlencoded", {
           status: 200,
           type: "plain",
-          size: "0.01kb",
+          size: L10N.getFormatStr("networkMenu.sizeKB", 0.01),
           time: true
         });
       verifyRequestItemTarget(RequestsMenu.getItemAtIndex(1),
         "POST", SIMPLE_SJS + "?foo=bar&baz=42&type=multipart", {
           status: 200,
           type: "plain",
-          size: "0.01kb",
+          size: L10N.getFormatStr("networkMenu.sizeKB", 0.01),
           time: true
         });
 
       EventUtils.sendMouseEvent({ type: "mousedown" },
         document.getElementById("details-pane-toggle"));
       EventUtils.sendMouseEvent({ type: "mousedown" },
         document.querySelectorAll("#details-pane tab")[2]);
 
--- a/browser/devtools/netmonitor/test/browser_net_prefs-and-l10n.js
+++ b/browser/devtools/netmonitor/test/browser_net_prefs-and-l10n.js
@@ -22,18 +22,18 @@ function test() {
 
       let bundleName = "chrome://browser/locale/devtools/netmonitor.properties";
       let stringBundle = Services.strings.createBundle(bundleName);
 
       is(L10N.getStr("netmonitor.label"),
         stringBundle.GetStringFromName("netmonitor.label"),
         "The getStr() method didn't return the expected string.");
 
-      is(L10N.getFormatStr("networkMenu.total", "foo"),
-        stringBundle.formatStringFromName("networkMenu.total", ["foo"], 1),
+      is(L10N.getFormatStr("networkMenu.totalMS", "foo"),
+        stringBundle.formatStringFromName("networkMenu.totalMS", ["foo"], 1),
         "The getFormatStr() method didn't return the expected string.");
     }
 
     function testPrefs() {
       let { Prefs } = aMonitor.panelWin;
 
       is(Prefs.root, "devtools.netmonitor",
         "The preferences object should have a correct root path.");
--- a/browser/devtools/netmonitor/test/browser_net_simple-request-data.js
+++ b/browser/devtools/netmonitor/test/browser_net_simple-request-data.js
@@ -4,17 +4,17 @@
 /**
  * Tests if requests render correct information in the menu UI.
  */
 
 function test() {
   initNetMonitor(SIMPLE_SJS).then(([aTab, aDebuggee, aMonitor]) => {
     info("Starting test... ");
 
-    let { NetMonitorView } = aMonitor.panelWin;
+    let { L10N, NetMonitorView } = aMonitor.panelWin;
     let { RequestsMenu } = NetMonitorView;
 
     RequestsMenu.lazyUpdate = false;
 
     waitForNetworkEvents(aMonitor, 1)
       .then(() => teardown(aMonitor))
       .then(finish);
 
@@ -157,17 +157,17 @@ function test() {
 
       is(requestItem.attachment.contentSize, "12",
         "The contentSize attachment has an incorrect value.");
       is(requestItem.attachment.mimeType, "text/plain; charset=utf-8",
         "The mimeType attachment has an incorrect value.");
 
       verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS, {
         type: "plain",
-        size: "0.01kb"
+        size: L10N.getFormatStr("networkMenu.sizeKB", 0.01),
       });
     });
 
     aMonitor.panelWin.once("NetMonitor:NetworkEventUpdated:ResponseContent", () => {
       let requestItem = RequestsMenu.getItemAtIndex(0);
 
       ok(requestItem.attachment.responseContent,
         "There should be a responseContent attachment available.");
@@ -175,17 +175,17 @@ function test() {
         "The responseContent attachment has an incorrect |content.mimeType| property.");
       is(requestItem.attachment.responseContent.content.text, "Hello world!",
         "The responseContent attachment has an incorrect |content.text| property.");
       is(requestItem.attachment.responseContent.content.size, 12,
         "The responseContent attachment has an incorrect |content.size| property.");
 
       verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS, {
         type: "plain",
-        size: "0.01kb"
+        size: L10N.getFormatStr("networkMenu.sizeKB", 0.01),
       });
     });
 
     aMonitor.panelWin.once("NetMonitor:NetworkEventUpdating:EventTimings", () => {
       let requestItem = RequestsMenu.getItemAtIndex(0);
 
       is(typeof requestItem.attachment.totalTime, "number",
         "The attached totalTime is incorrect.");
--- a/browser/devtools/netmonitor/test/browser_net_simple-request-details.js
+++ b/browser/devtools/netmonitor/test/browser_net_simple-request-details.js
@@ -66,17 +66,17 @@ function test() {
       is(tabpanel.querySelectorAll(".variables-view-empty-notice").length, 0,
         "The empty notice should not be displayed in this tabpanel.");
 
       let responseScope = tabpanel.querySelectorAll(".variables-view-scope")[0];
       let requestScope = tabpanel.querySelectorAll(".variables-view-scope")[1];
 
       is(responseScope.querySelector(".name").getAttribute("value"),
         L10N.getStr("responseHeaders") + " (" +
-        L10N.getFormatStr("networkMenu.size", "0.169") + ")",
+        L10N.getFormatStr("networkMenu.sizeKB", "0.169") + ")",
         "The response headers scope doesn't have the correct title.");
 
       ok(requestScope.querySelector(".name").getAttribute("value").contains(
         L10N.getStr("requestHeaders") + " (0."),
         // Can't test for full request headers title because the size may
         // vary across platforms ("User-Agent" header differs).
         "The request headers scope doesn't have the correct title.");
 
@@ -191,35 +191,35 @@ function test() {
 
       let tab = document.querySelectorAll("#details-pane tab")[4];
       let tabpanel = document.querySelectorAll("#details-pane tabpanel")[4];
 
       is(tab.getAttribute("selected"), "true",
         "The timings tab in the network details pane should be selected.");
 
       ok(tabpanel.querySelector("#timings-summary-blocked .requests-menu-timings-total")
-        .getAttribute("value").match(/[0-9]+ms$/),
+        .getAttribute("value").match(/[0-9]+/),
         "The blocked timing info does not appear to be correct.");
 
       ok(tabpanel.querySelector("#timings-summary-dns .requests-menu-timings-total")
-        .getAttribute("value").match(/[0-9]+ms$/),
+        .getAttribute("value").match(/[0-9]+/),
         "The dns timing info does not appear to be correct.");
 
       ok(tabpanel.querySelector("#timings-summary-connect .requests-menu-timings-total")
-        .getAttribute("value").match(/[0-9]+ms$/),
+        .getAttribute("value").match(/[0-9]+/),
         "The connect timing info does not appear to be correct.");
 
       ok(tabpanel.querySelector("#timings-summary-send .requests-menu-timings-total")
-        .getAttribute("value").match(/[0-9]+ms$/),
+        .getAttribute("value").match(/[0-9]+/),
         "The send timing info does not appear to be correct.");
 
       ok(tabpanel.querySelector("#timings-summary-wait .requests-menu-timings-total")
-        .getAttribute("value").match(/[0-9]+ms$/),
+        .getAttribute("value").match(/[0-9]+/),
         "The wait timing info does not appear to be correct.");
 
       ok(tabpanel.querySelector("#timings-summary-receive .requests-menu-timings-total")
-        .getAttribute("value").match(/[0-9]+ms$/),
+        .getAttribute("value").match(/[0-9]+/),
         "The receive timing info does not appear to be correct.");
     }
 
     aDebuggee.location.reload();
   });
 }
--- a/browser/devtools/netmonitor/test/browser_net_status-codes.js
+++ b/browser/devtools/netmonitor/test/browser_net_status-codes.js
@@ -17,45 +17,45 @@ function test() {
 
     waitForNetworkEvents(aMonitor, 5).then(() => {
       let requestItems = [];
 
       verifyRequestItemTarget(requestItems[0] = RequestsMenu.getItemAtIndex(0),
         "GET", STATUS_CODES_SJS + "?sts=100", {
           status: 101,
           type: "plain",
-          size: "0.00kb",
+          size: L10N.getFormatStr("networkMenu.sizeKB", "0.00"),
           time: true
         });
       verifyRequestItemTarget(requestItems[1] = RequestsMenu.getItemAtIndex(1),
         "GET", STATUS_CODES_SJS + "?sts=200", {
           status: 202,
           type: "plain",
-          size: "0.02kb",
+          size: L10N.getFormatStr("networkMenu.sizeKB", 0.02),
           time: true
         });
       verifyRequestItemTarget(requestItems[2] = RequestsMenu.getItemAtIndex(2),
         "GET", STATUS_CODES_SJS + "?sts=300", {
           status: 303,
           type: "plain",
-          size: "0.00kb",
+          size: L10N.getFormatStr("networkMenu.sizeKB", "0.00"),
           time: true
         });
       verifyRequestItemTarget(requestItems[3] = RequestsMenu.getItemAtIndex(3),
         "GET", STATUS_CODES_SJS + "?sts=400", {
           status: 404,
           type: "plain",
-          size: "0.02kb",
+          size: L10N.getFormatStr("networkMenu.sizeKB", 0.02),
           time: true
         });
       verifyRequestItemTarget(requestItems[4] = RequestsMenu.getItemAtIndex(4),
         "GET", STATUS_CODES_SJS + "?sts=500", {
           status: 501,
           type: "plain",
-          size: "0.02kb",
+          size: L10N.getFormatStr("networkMenu.sizeKB", 0.02),
           time: true
         });
 
       // Test summaries...
       EventUtils.sendMouseEvent({ type: "mousedown" },
         document.querySelectorAll("#details-pane tab")[0]);
 
       EventUtils.sendMouseEvent({ type: "mousedown" }, requestItems[0].target);
--- a/browser/locales/en-US/chrome/browser/devtools/netmonitor.properties
+++ b/browser/locales/en-US/chrome/browser/devtools/netmonitor.properties
@@ -85,14 +85,14 @@ requestCookies=Request cookies
 # in the network details params tab identifying the response cookies.
 responseCookies=Response cookies
 
 # LOCALIZATION NOTE (jsonFilterText): This is the text displayed
 # in the response tab of the network details pane for the JSON filtering input.
 jsonFilterText=Filter properties
 
 # LOCALIZATION NOTE (networkMenu.size): This is the label displayed
-# in the network menu specifying the size of a request (in kb).
-networkMenu.size=%Skb
+# in the network menu specifying the size of a request (in kilobytes).
+networkMenu.sizeKB=%S KB
 
 # LOCALIZATION NOTE (networkMenu.total): This is the label displayed
-# in the network menu specifying the time for a request to finish (in ms).
-networkMenu.total=→ %Sms
+# in the network menu specifying the time for a request to finish (in milliseconds).
+networkMenu.totalMS=→ %S ms