gecko/dom/base/test/bug403852_fileOpener.js
Jed Davis 45f8681fa5 Bug 1068838 - Fix file input element tests to open files in the parent process. r=sicking
The dom/base tests changed here use SpecialPowers.loadChromeScript to
construct a DOM File in the parent and send it to the child, using the
existing remote-blob infrastructure.  The dom/html tests don't need a
real file, so they now construct in-memory files.

As a convenient side-effect, these tests are now enabled for desktop
e10s (they were already being run out-of-process on B2G); most of them
failed before this change due to the code that's being moved/removed.
2015-01-26 16:23:00 -08:00

16 lines
498 B
JavaScript

const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.importGlobalProperties(["File"]);
let 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 () {
sendAsyncMessage("file.opened", {
file: new File(testFile),
mtime: testFile.lastModifiedTime,
});
});