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

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