summaryrefslogtreecommitdiffstats
path: root/dom/base/test/bug403852_fileOpener.js
blob: 3a818a97e85c669886930183d1fe5fc1ae37a2a2 (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
/* eslint-env mozilla/chrome-script */

Cu.importGlobalProperties(["File"]);

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

addMessageListener("file.open", function() {
  File.createFromNsIFile(testFile).then(function(file) {
    File.createFromNsIFile(testFile, { lastModified: 123 }).then(function(
      fileWithDate
    ) {
      sendAsyncMessage("file.opened", {
        file,
        mtime: testFile.lastModifiedTime,
        fileWithDate,
        fileDate: 123,
      });
    });
  });
});