summaryrefslogtreecommitdiffstats
path: root/dom/html/test/script_fakepath.js
blob: f95ac493d289bde48a0a3b7099443f15a7dae588 (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 tmpFile = Cc["@mozilla.org/file/directory_service;1"]
    .getService(Ci.nsIDirectoryService)
    .QueryInterface(Ci.nsIProperties)
    .get("ProfD", Ci.nsIFile);
  tmpFile.append("prefs.js");

  File.createFromNsIFile(tmpFile).then(file => {
    sendAsyncMessage("file.opened", { data: [file] });
  });
});