summaryrefslogtreecommitdiffstats
path: root/dom/html/test/formSubmission_chrome.js
blob: 64e7f2dd968e834985a07e779e0aa75c7066b684 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* eslint-env mozilla/chrome-script */

Cu.importGlobalProperties(["File"]);

addMessageListener("files.open", function (message) {
  let list = [];
  let promises = [];
  for (let path of message) {
    promises.push(
      File.createFromFileName(path).then(file => {
        list.push(file);
      })
    );
  }

  Promise.all(promises).then(() => {
    sendAsyncMessage("files.opened", list);
  });
});