Bug 1499906 (attempt 2) - Put some parameters in `aFoo` form. erahm
authorNicholas Nethercote <nnethercote@mozilla.com>
Fri, 19 Oct 2018 15:11:41 +1100
changeset 490395 1752794d80abffc53fe6ffa689fcd1648195b6af
parent 490394 d8c9c172c24599b14ce744fd5b9f01f5916e5ae9
child 490396 f35ac5e55bb4ea3a74c53b964bec3627c984961b
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
bugs1499906
milestone64.0a1
Bug 1499906 (attempt 2) - Put some parameters in `aFoo` form. erahm
toolkit/components/aboutmemory/content/aboutMemory.js
--- a/toolkit/components/aboutmemory/content/aboutMemory.js
+++ b/toolkit/components/aboutmemory/content/aboutMemory.js
@@ -83,37 +83,37 @@ function assert(aCond, aMsg) {
 
 // This is used for malformed input from memory reporters.
 function assertInput(aCond, aMsg) {
   if (!aCond) {
     throw new Error("Invalid memory report(s): " + aMsg);
   }
 }
 
-function handleException(ex) {
-  let str = "" + ex;
+function handleException(aEx) {
+  let str = "" + aEx;
   if (str.startsWith(gAssertionFailureMsgPrefix)) {
     // Argh, assertion failure within this file!  Give up.
-    throw ex;
+    throw aEx;
   } else {
     // File or memory reporter problem.  Print a message.
     updateMainAndFooter(str, NO_TIMESTAMP, HIDE_FOOTER, "badInputWarning");
   }
 }
 
 function reportAssertionFailure(aMsg) {
   let debug = Cc["@mozilla.org/xpcom/debug;1"].getService(Ci.nsIDebug2);
   if (debug.isDebugBuild) {
     debug.assertion(aMsg, "false", "aboutMemory.js", 0);
   }
 }
 
-function debug(x) {
+function debug(aVal) {
   let section = appendElement(document.body, "div", "section");
-  appendElementWithText(section, "div", "debug", JSON.stringify(x));
+  appendElementWithText(section, "div", "debug", JSON.stringify(aVal));
 }
 
 // ---------------------------------------------------------------------------
 
 function onUnload() {
 }
 
 // ---------------------------------------------------------------------------
@@ -259,28 +259,27 @@ function onLoad() {
   // A hidden file input element that can be invoked when necessary.
   let fileInput1 = appendHiddenFileInput(header, "fileInput1", function() {
     let file = this.files[0];
     let filename = file.mozFullPath;
     updateAboutMemoryFromFile(filename);
   });
 
   // Ditto.
-  let fileInput2 =
-      appendHiddenFileInput(header, "fileInput2", function(e) {
+  let fileInput2 = appendHiddenFileInput(header, "fileInput2", function(aElem) {
     let file = this.files[0];
     // First time around, we stash a copy of the filename and reinvoke.  Second
     // time around we do the diff and display.
     if (!this.filename1) {
       this.filename1 = file.mozFullPath;
 
-      // e.skipClick is only true when testing -- it allows fileInput2's
+      // aElem.skipClick is only true when testing -- it allows fileInput2's
       // onchange handler to be re-called without having to go via the file
       // picker.
-      if (!e.skipClick) {
+      if (!aElem.skipClick) {
         this.click();
       }
     } else {
       let filename1 = this.filename1;
       delete this.filename1;
       updateAboutMemoryFromTwoFiles(filename1, file.mozFullPath);
     }
   });
@@ -468,23 +467,23 @@ function doDMD() {
 function dumpGCLogAndCCLog(aVerbose) {
   let dumper = Cc["@mozilla.org/memory-info-dumper;1"]
                 .getService(Ci.nsIMemoryInfoDumper);
 
   let inProgress = updateMainAndFooter("Saving logs...",
                                        NO_TIMESTAMP, HIDE_FOOTER);
   let section = appendElement(gMain, "div", "section");
 
-  function displayInfo(gcLog, ccLog, isParent) {
+  function displayInfo(aGCLog, aCCLog, aIsParent) {
     appendElementWithText(section, "div", "",
-                          "Saved GC log to " + gcLog.path);
+                          "Saved GC log to " + aGCLog.path);
 
     let ccLogType = aVerbose ? "verbose" : "concise";
     appendElementWithText(section, "div", "",
-                          "Saved " + ccLogType + " CC log to " + ccLog.path);
+                          "Saved " + ccLogType + " CC log to " + aCCLog.path);
   }
 
   dumper.dumpGCAndCCLogsToFile("", aVerbose, /* dumpChildProcesses = */ true,
                                { onDump: displayInfo,
                                  onFinish() {
                                    inProgress.remove();
                                  },
                                });
@@ -1659,19 +1658,19 @@ function appendMrNameSpan(aP, aDescripti
 // 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.
 let gShowSubtreesBySafeTreeId = {};
 
-function assertClassListContains(e, className) {
-  assert(e, "undefined " + className);
-  assert(e.classList.contains(className), "classname isn't " + className);
+function assertClassListContains(aElem, aClassName) {
+  assert(aElem, "undefined " + aClassName);
+  assert(aElem.classList.contains(aClassName), "classname isn't " + aClassName);
 }
 
 function toggle(aEvent) {
   // This relies on each line being a span that contains at least four spans:
   // mrValue, mrPerc, mrSep, mrName, and then zero or more mrNotes.  All
   // whitespace must be within one of these spans for this function to find the
   // right nodes.  And the span containing the children of this line must
   // immediately follow.  Assertions check this.
@@ -1885,41 +1884,41 @@ function appendSectionHeader(aP, aText) 
 function saveReportsToFile() {
   let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
   fp.appendFilter("Zipped JSON files", "*.json.gz");
   fp.appendFilters(Ci.nsIFilePicker.filterAll);
   fp.filterIndex = 0;
   fp.addToRecentDocs = true;
   fp.defaultString = "memory-report.json.gz";
 
-  let fpFinish = function(file) {
+  let fpFinish = function(aFile) {
     let dumper = Cc["@mozilla.org/memory-info-dumper;1"]
                    .getService(Ci.nsIMemoryInfoDumper);
     let finishDumping = () => {
-      updateMainAndFooter("Saved memory reports to " + file.path,
+      updateMainAndFooter("Saved memory reports to " + aFile.path,
                           SHOW_TIMESTAMP, HIDE_FOOTER);
     };
-    dumper.dumpMemoryReportsToNamedFile(file.path, finishDumping, null,
+    dumper.dumpMemoryReportsToNamedFile(aFile.path, finishDumping, null,
                                         gAnonymize.checked);
   };
 
   let fpCallback = function(aResult) {
     if (aResult == Ci.nsIFilePicker.returnOK ||
         aResult == Ci.nsIFilePicker.returnReplace) {
       fpFinish(fp.file);
     }
   };
 
   try {
     fp.init(window, "Save Memory Reports", Ci.nsIFilePicker.modeSave);
   } catch (ex) {
     // This will fail on Android, since there is no Save as file picker there.
     // Just save to the default downloads dir if it does.
-    Downloads.getSystemDownloadsDirectory().then(function(dirPath) {
-      let file = FileUtils.File(dirPath);
+    Downloads.getSystemDownloadsDirectory().then(function(aDirPath) {
+      let file = FileUtils.File(aDirPath);
       file.append(fp.defaultString);
       fpFinish(file);
     });
 
     return;
   }
   fp.open(fpCallback);
 }