Bug 1366061 - Fix memory tool file picker; r=fitzgen
authorGreg Tatum <tatum.creative@gmail.com>
Fri, 19 May 2017 16:11:49 -0500
changeset 359788 2c91f590eb02b578938bd73356b9f9cf4613ea73
parent 359787 668d04c309ff22984346310c54e585f505ab9d6b
child 359789 4d982435bab00d1577deb17acfc1eb78475a1b29
push id43075
push usergtatum@mozilla.com
push dateSun, 21 May 2017 00:10:22 +0000
treeherderautoland@2c91f590eb02 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfitzgen
bugs1366061
milestone55.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 1366061 - Fix memory tool file picker; r=fitzgen MozReview-Commit-ID: JNrIGmXlZ46
devtools/client/memory/utils.js
--- a/devtools/client/memory/utils.js
+++ b/devtools/client/memory/utils.js
@@ -409,25 +409,27 @@ exports.getSnapshotTotals = function (ce
  * @param {String} .defaultName
  *        The default name chosen by the file picker window.
  * @param {String} .mode
  *        The mode that this filepicker should open in. Can be "open" or "save".
  * @return {Promise<?nsILocalFile>}
  *        The file selected by the user, or null, if cancelled.
  */
 exports.openFilePicker = function ({ title, filters, defaultName, mode }) {
-  mode = mode === "save" ? Ci.nsIFilePicker.modeSave : null;
-  mode = mode === "open" ? Ci.nsIFilePicker.modeOpen : null;
-
-  if (mode == void 0) {
+  let fpMode;
+  if (mode === "save") {
+    fpMode = Ci.nsIFilePicker.modeSave;
+  } else if (mode === "open") {
+    fpMode = Ci.nsIFilePicker.modeOpen;
+  } else {
     throw new Error("No valid mode specified for nsIFilePicker.");
   }
 
   let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
-  fp.init(window, title, mode);
+  fp.init(window, title, fpMode);
 
   for (let filter of (filters || [])) {
     fp.appendFilter(filter[0], filter[1]);
   }
   fp.defaultString = defaultName;
 
   return new Promise(resolve => {
     fp.open({