Index: chrome/content/ui/filters-backup.js |
=================================================================== |
--- a/chrome/content/ui/filters-backup.js |
+++ b/chrome/content/ui/filters-backup.js |
@@ -92,30 +92,32 @@ var Backup = |
* Called when the Restore menu is being opened, fills in "Automated backup" |
* entries. |
*/ |
fillRestorePopup: function() |
{ |
while (this.restoreInsertionPoint.nextSibling && !this.restoreInsertionPoint.nextSibling.id) |
this.restoreInsertionPoint.parentNode.removeChild(this.restoreInsertionPoint.nextSibling); |
- let files = FilterStorage.getBackupFiles().reverse(); |
- for (let i = 0; i < files.length; i++) |
+ FilterStorage.getBackupFiles().then(backups => |
{ |
- let file = files[i]; |
- let item = this.restoreTemplate.cloneNode(true); |
- let label = item.getAttribute("label"); |
- label = label.replace(/\?1\?/, Utils.formatTime(file.lastModifiedTime)); |
- item.setAttribute("label", label); |
- item.addEventListener("command", function() |
+ backups.reverse(); |
+ for (let backup of backups) |
{ |
- Backup.restoreAllData(file); |
- }, false); |
- this.restoreInsertionPoint.parentNode.insertBefore(item, this.restoreInsertionPoint.nextSibling); |
- } |
+ let item = this.restoreTemplate.cloneNode(true); |
+ let label = item.getAttribute("label"); |
+ label = label.replace(/\?1\?/, Utils.formatTime(backup.lastModified)); |
+ item.setAttribute("label", label); |
+ item.addEventListener("command", function() |
kzar
2017/03/30 05:45:51
Nit: Any reason not to use an arrow function here?
Wladimir Palant
2017/03/30 10:13:11
I'd rather not make unnecessary changes to this co
|
+ { |
+ Backup.restoreAllData(backup.file); |
+ }, false); |
+ this.restoreInsertionPoint.parentNode.insertBefore(item, this.restoreInsertionPoint.nextSibling); |
kzar
2017/03/30 05:45:51
Nit: Long line.
Wladimir Palant
2017/03/30 10:13:11
Same here, I'd rather not make unnecessary changes
|
+ } |
+ }); |
}, |
/** |
* Lets the user choose a file to restore filters from. |
*/ |
restoreFromFile: function() |
{ |
let picker = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); |