summaryrefslogtreecommitdiffstats
path: root/dom/base/test/bug403852_fileOpener.js
blob: b35fa8fbcf0fb394ce923d630a552d4b4047f9e5 (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,
      });
    });
  });
});