summaryrefslogtreecommitdiffstats
path: root/dom/file/tests/create_file_objects.js
blob: 2e4c29f526fa1eb109481ce44377ef09a417e899 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Cu.importGlobalProperties(["File"]);

addMessageListener("create-file-objects", function(message) {
  let files = [];
  let promises = [];
  for (fileName of message.fileNames) {
    promises.push(
      File.createFromFileName(fileName).then(function(file) {
        files.push(file);
      })
    );
  }

  Promise.all(promises).then(function() {
    sendAsyncMessage("created-file-objects", files);
  });
});