Bug 1404130- Cache L10N values in status bar; r=gasolin
authorPradeep <pradeepgangwar39@gmail.com>
Mon, 09 Oct 2017 20:21:37 +0530
changeset 385422 4753cd9ea2d9
parent 385421 86e78965f717
child 385423 2477db05f20d
push id32655
push userarchaeopteryx@coole-files.de
push dateWed, 11 Oct 2017 09:38:36 +0000
treeherdermozilla-central@a72bd6160609 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgasolin
bugs1404130
milestone58.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 1404130- Cache L10N values in status bar; r=gasolin MozReview-Commit-ID: 23sm6hux6mf *** Bug 1404130- Cache L10N values in status bar; r=gasolin MozReview-Commit-ID: ECs1Td12ajW
devtools/client/netmonitor/src/components/status-bar.js
--- a/devtools/client/netmonitor/src/components/status-bar.js
+++ b/devtools/client/netmonitor/src/components/status-bar.js
@@ -18,64 +18,73 @@ const {
 const {
   getFormattedSize,
   getFormattedTime,
 } = require("../utils/format-utils");
 const { L10N } = require("../utils/l10n");
 
 const { button, div } = DOM;
 
+const REQUESTS_COUNT_EMPTY = L10N.getStr("networkMenu.summary.requestsCountEmpty");
+const TOOLTIP_PERF = L10N.getStr("networkMenu.summary.tooltip.perf");
+const TOOLTIP_REQUESTS_COUNT = L10N.getStr("networkMenu.summary.tooltip.requestsCount");
+const TOOLTIP_TRANSFERRED = L10N.getStr("networkMenu.summary.tooltip.transferred");
+const TOOLTIP_FINISH = L10N.getStr("networkMenu.summary.tooltip.finish");
+const TOOLTIP_DOM_CONTENT_LOADED =
+        L10N.getStr("networkMenu.summary.tooltip.domContentLoaded");
+const TOOLTIP_LOAD = L10N.getStr("networkMenu.summary.tooltip.load");
+
 function StatusBar({ summary, openStatistics, timingMarkers }) {
   let { count, contentSize, transferredSize, millis } = summary;
   let {
     DOMContentLoaded,
     load,
   } = timingMarkers;
 
-  let countText = count === 0 ? L10N.getStr("networkMenu.summary.requestsCountEmpty") :
+  let countText = count === 0 ? REQUESTS_COUNT_EMPTY :
     PluralForm.get(
       count, L10N.getFormatStrWithNumbers("networkMenu.summary.requestsCount", count)
   );
   let transferText = L10N.getFormatStrWithNumbers("networkMenu.summary.transferred",
     getFormattedSize(contentSize), getFormattedSize(transferredSize));
   let finishText = L10N.getFormatStrWithNumbers("networkMenu.summary.finish",
     getFormattedTime(millis));
 
   return (
     div({ className: "devtools-toolbar devtools-toolbar-bottom" },
       button({
         className: "devtools-button requests-list-network-summary-button",
-        title: L10N.getStr("networkMenu.summary.tooltip.perf"),
+        title: TOOLTIP_PERF,
         onClick: openStatistics,
       },
         div({ className: "summary-info-icon" }),
       ),
       div({
         className: "status-bar-label requests-list-network-summary-count",
-        title: L10N.getStr("networkMenu.summary.tooltip.requestsCount"),
+        title: TOOLTIP_REQUESTS_COUNT,
       }, countText),
       count !== 0 &&
         div({
           className: "status-bar-label requests-list-network-summary-transfer",
-          title: L10N.getStr("networkMenu.summary.tooltip.transferred"),
+          title: TOOLTIP_TRANSFERRED,
         }, transferText),
       count !== 0 &&
         div({
           className: "status-bar-label requests-list-network-summary-finish",
-          title: L10N.getStr("networkMenu.summary.tooltip.finish"),
+          title: TOOLTIP_FINISH,
         }, finishText),
       DOMContentLoaded > -1 &&
         div({
           className: "status-bar-label dom-content-loaded",
-          title: L10N.getStr("networkMenu.summary.tooltip.domContentLoaded"),
+          title: TOOLTIP_DOM_CONTENT_LOADED,
         }, `DOMContentLoaded: ${getFormattedTime(DOMContentLoaded)}`),
       load > -1 &&
         div({
           className: "status-bar-label load",
-          title: L10N.getStr("networkMenu.summary.tooltip.load"),
+          title: TOOLTIP_LOAD,
         }, `load: ${getFormattedTime(load)}`),
     )
   );
 }
 
 StatusBar.displayName = "StatusBar";
 
 StatusBar.propTypes = {