зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1344145 - HarUtils.getTargetFile is not used, r=honza
This commit is contained in:
Родитель
77f2f8b1ac
Коммит
62fd4d3b98
|
@ -26,8 +26,6 @@ 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),
|
||||
|
@ -52,31 +50,6 @@ function formatDate(date) {
|
|||
* 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";
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче