Bug 1344145 - HarUtils.getTargetFile is not used, r=honza
authorAndrea Marchesini <amarchesini@mozilla.com>
Fri, 03 Mar 2017 15:21:12 +0100
changeset 493422 b9f1821ed5111b515912051c692d98bace3b2943
parent 493421 cfd2fd77ff046cfbe2d1693858f093df9af41d74
child 493423 c3e6f013c7718a829dbd34f2941708fb86bca4b5
push id47755
push userbmo:dkeeler@mozilla.com
push dateFri, 03 Mar 2017 22:32:10 +0000
reviewershonza
bugs1344145
milestone54.0a1
Bug 1344145 - HarUtils.getTargetFile is not used, r=honza
devtools/client/netmonitor/har/har-utils.js
--- a/devtools/client/netmonitor/har/har-utils.js
+++ b/devtools/client/netmonitor/har/har-utils.js
@@ -21,18 +21,16 @@ XPCOMUtils.defineLazyGetter(this, "ZipWr
 XPCOMUtils.defineLazyGetter(this, "LocalFile", function () {
   return new CC("@mozilla.org/file/local;1", "nsILocalFile", "initWithPath");
 });
 
 XPCOMUtils.defineLazyGetter(this, "getMostRecentBrowserWindow", function () {
   return require("sdk/window/utils").getMostRecentBrowserWindow;
 });
 
-const nsIFilePicker = Ci.nsIFilePicker;
-
 const OPEN_FLAGS = {
   RDONLY: parseInt("0x01", 16),
   WRONLY: parseInt("0x02", 16),
   CREATE_FILE: parseInt("0x08", 16),
   APPEND: parseInt("0x10", 16),
   TRUNCATE: parseInt("0x20", 16),
   EXCL: parseInt("0x80", 16)
 };
@@ -47,41 +45,16 @@ function formatDate(date) {
 
   return `${year}-${month}-${day} ${hour}-${minutes}-${seconds}`;
 }
 
 /**
  * Helper API for HAR export features.
  */
 var HarUtils = {
-  /**
-   * Open File Save As dialog and let the user pick the proper file
-   * location for generated HAR log.
-   */
-  getTargetFile: function (fileName, jsonp, compress, cb) {
-    let browser = getMostRecentBrowserWindow();
-
-    let fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
-    fp.init(browser, null, nsIFilePicker.modeSave);
-    fp.appendFilter(
-      "HTTP Archive Files", "*.har; *.harp; *.json; *.jsonp; *.zip");
-    fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText);
-    fp.filterIndex = 1;
-
-    fp.defaultString = this.getHarFileName(fileName, jsonp, compress);
-
-    fp.open(rv => {
-      if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
-        cb(fp.file);
-      } else {
-        cb(null);
-      }
-    });
-  },
-
   getHarFileName: function (defaultFileName, jsonp, compress) {
     let extension = jsonp ? ".harp" : ".har";
 
     let now = new Date();
     let name = defaultFileName.replace(/%date/g, formatDate(now));
     name = name.replace(/\:/gm, "-", "");
     name = name.replace(/\//gm, "_", "");