Bug 1499906 (attempt 2) - Change `var` to `let`. r=erahm
authorNicholas Nethercote <nnethercote@mozilla.com>
Fri, 19 Oct 2018 15:09:46 +1100
changeset 500573 838f16e6dcf2239d5b94dc5d5086f22558467dba
parent 500572 51a3a633315cebea2c31fb871d6c35300b529313
child 500574 edee090da6bdce1e744b951145b0afa4ac4bd9d4
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1499906
milestone64.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 1499906 (attempt 2) - Change `var` to `let`. r=erahm
toolkit/components/aboutmemory/content/aboutMemory.js
--- a/toolkit/components/aboutmemory/content/aboutMemory.js
+++ b/toolkit/components/aboutmemory/content/aboutMemory.js
@@ -13,17 +13,17 @@
 // "file=" argument, and obviously the filename is case-sensitive iff you're on
 // a case-sensitive filesystem.  If you specify more than one "file=" argument,
 // only the first one is used.
 
 "use strict";
 
 // ---------------------------------------------------------------------------
 
-var CC = Components.Constructor;
+let CC = Components.Constructor;
 
 const KIND_NONHEAP           = Ci.nsIMemoryReporter.KIND_NONHEAP;
 const KIND_HEAP              = Ci.nsIMemoryReporter.KIND_HEAP;
 const KIND_OTHER             = Ci.nsIMemoryReporter.KIND_OTHER;
 
 const UNITS_BYTES            = Ci.nsIMemoryReporter.UNITS_BYTES;
 const UNITS_COUNT            = Ci.nsIMemoryReporter.UNITS_COUNT;
 const UNITS_COUNT_CUMULATIVE = Ci.nsIMemoryReporter.UNITS_COUNT_CUMULATIVE;
@@ -43,25 +43,25 @@ XPCOMUtils.defineLazyGetter(this, "nsBin
                                      "setInputStream"));
 XPCOMUtils.defineLazyGetter(this, "nsFile",
                             () => CC("@mozilla.org/file/local;1",
                                      "nsIFile", "initWithPath"));
 XPCOMUtils.defineLazyGetter(this, "nsGzipConverter",
                             () => CC("@mozilla.org/streamconv;1?from=gzip&to=uncompressed",
                                      "nsIStreamConverter"));
 
-var gMgr = Cc["@mozilla.org/memory-reporter-manager;1"]
+let gMgr = Cc["@mozilla.org/memory-reporter-manager;1"]
              .getService(Ci.nsIMemoryReporterManager);
 
 const gPageName = "about:memory";
 document.title = gPageName;
 
 const gUnnamedProcessStr = "Main Process";
 
-var gIsDiff = false;
+let gIsDiff = false;
 
 // ---------------------------------------------------------------------------
 
 // Forward slashes in URLs in paths are represented with backslashes to avoid
 // being mistaken for path separators.  Paths/names where this hasn't been
 // undone are prefixed with "unsafe"; the rest are prefixed with "safe".
 function flipBackslashes(aUnsafeStr) {
   // Save memory by only doing the replacement if it's necessary.
@@ -115,26 +115,26 @@ function debug(x) {
 
 function onUnload() {
 }
 
 // ---------------------------------------------------------------------------
 
 // The <div> holding everything but the header and footer (if they're present).
 // It's what is updated each time the page changes.
-var gMain;
+let gMain;
 
 // The <div> holding the footer.
-var gFooter;
+let gFooter;
 
 // The "verbose" checkbox.
-var gVerbose;
+let gVerbose;
 
 // The "anonymize" checkbox.
-var gAnonymize;
+let gAnonymize;
 
 // Values for the |aFooterAction| argument to updateTitleMainAndFooter.
 const HIDE_FOOTER = 0;
 const SHOW_FOOTER = 1;
 
 // Values for the |aShowTimestamp| argument to updateTitleMainAndFooter.
 const NO_TIMESTAMP = 0;
 const SHOW_TIMESTAMP = 1;
@@ -522,17 +522,17 @@ function updateAboutMemoryFromReporters(
 
   } catch (ex) {
     handleException(ex);
   }
 }
 
 // Increment this if the JSON format changes.
 //
-var gCurrentFileFormatVersion = 1;
+let gCurrentFileFormatVersion = 1;
 
 
 /**
  * Parse a string as JSON and extract the |memory_report| property if it has
  * one, which indicates the string is from a crash dump.
  *
  * @param aStr
  *        The string.
@@ -696,17 +696,17 @@ function updateAboutMemoryFromTwoFiles(a
       }
     });
   });
 }
 
 // ---------------------------------------------------------------------------
 
 // Something unlikely to appear in a process name.
-var kProcessPathSep = "^:^:^";
+let kProcessPathSep = "^:^:^";
 
 // Short for "diff report".
 function DReport(aKind, aUnits, aAmount, aDescription, aNMerged, aPresence) {
   this._kind = aKind;
   this._units = aUnits;
   this._amount = aAmount;
   this._description = aDescription;
   this._nMerged = aNMerged;
@@ -1341,17 +1341,17 @@ function sortTreeAndInsertAggregateNodes
   // is significant;  there's no point creating an aggregate node that only has
   // one child.  Just process it.
   sortTreeAndInsertAggregateNodes(aTotalBytes, aT._kids[i]);
 }
 
 // Global variable indicating if we've seen any invalid values for this
 // process;  it holds the unsafePaths of any such reports.  It is reset for
 // each new process.
-var gUnsafePathsWithInvalidValuesForThisProcess = [];
+let gUnsafePathsWithInvalidValuesForThisProcess = [];
 
 function appendWarningElements(aP, aHasKnownHeapAllocated,
                                aHasMozMallocUsableSize) {
   if (!aHasKnownHeapAllocated && !aHasMozMallocUsableSize) {
     appendElementWithText(aP, "p", "",
       "WARNING: the 'heap-allocated' memory reporter and the " +
       "moz_malloc_usable_size() function do not work for this platform " +
       "and/or configuration.  This means that 'heap-unclassified' is not " +
@@ -1681,17 +1681,17 @@ function appendMrNameSpan(aP, aDescripti
 
 // This is used to record the (safe) IDs of which sub-trees have been manually
 // expanded (marked as true) and collapsed (marked as false).  It's used to
 // replicate the collapsed/expanded state when the page is updated.  It can end
 // up holding IDs of nodes that no longer exist, e.g. for compartments that
 // have been closed.  This doesn't seem like a big deal, because the number is
 // limited by the number of entries the user has changed from their original
 // state.
-var gShowSubtreesBySafeTreeId = {};
+let gShowSubtreesBySafeTreeId = {};
 
 function assertClassListContains(e, className) {
   assert(e, "undefined " + className);
   assert(e.classList.contains(className), "classname isn't " + className);
 }
 
 function toggle(aEvent) {
   // This relies on each line being a span that contains at least four spans: