summaryrefslogtreecommitdiffstats
path: root/dom/base/test/script_postmessages_fileList.js
blob: 05b4d9d1ba17c4aa190a2ce1cbb50a53afa91c30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.importGlobalProperties(["File"]);

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

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

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

  sendAsyncMessage("dir.opened", {
    dir: testFile.path
  });
});