gecko/dom/base/test/bug578096LoadChromeScript.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

17 lines
585 B
JavaScript

var file;
Components.utils.importGlobalProperties(["File"]);
addMessageListener("file.create", function (message) {
file = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("TmpD", Components.interfaces.nsIFile);
file.append("foo.txt");
file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0600);
sendAsyncMessage("file.created", new File(file));
});
addMessageListener("file.remove", function (message) {
file.remove(false);
sendAsyncMessage("file.removed", {});
});