Bug 1335536 - File.createFromNsIFile and File.createFromFileName should be async - part 1 - tests, r=smaug
This commit is contained in:
@@ -2,9 +2,14 @@ Components.utils.importGlobalProperties(['File']);
|
||||
|
||||
addMessageListener("create-file-objects", function(message) {
|
||||
let files = []
|
||||
let promises = [];
|
||||
for (fileName of message.fileNames) {
|
||||
files.push(File.createFromFileName(fileName));
|
||||
promises.push(File.createFromFileName(fileName).then(function(file) {
|
||||
files.push(file);
|
||||
}));
|
||||
}
|
||||
|
||||
sendAsyncMessage("created-file-objects", files);
|
||||
Promise.all(promises).then(function() {
|
||||
sendAsyncMessage("created-file-objects", files);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user