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

// eslint-disable-next-line mozilla/reject-importGlobalProperties
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 });
  });
});