summaryrefslogtreecommitdiffstats
path: root/dom/serviceworkers/test/script_file_upload.js
blob: ff839744b2be7b87b9e3bc19bac6db0c40d57079 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* eslint-env mozilla/chrome-script */

Cu.importGlobalProperties(["File"]);

addMessageListener("file.open", function(e) {
  var testFile = Cc["@mozilla.org/file/directory_service;1"]
    .getService(Ci.nsIDirectoryService)
    .QueryInterface(Ci.nsIProperties)
    .get("ProfD", Ci.nsIFile);
  testFile.append("prefs.js");

  File.createFromNsIFile(testFile).then(function(file) {
    sendAsyncMessage("file.opened", { file });
  });
});