3 const { HttpServer
} = ChromeUtils
.importESModule(
4 "resource://testing-common/httpd.sys.mjs"
8 const BUGID
= "263127";
11 QueryInterface
: ChromeUtils
.generateQI(["nsIDownloadObserver"]),
13 onDownloadComplete(downloader
, request
, status
, file
) {
15 server
.stop(do_test_finished
);
18 do_throw("Download failed");
27 Assert
.ok(!file
.exists());
35 server
= new HttpServer();
38 // Initialize downloader
39 var channel
= NetUtil
.newChannel({
40 uri
: "http://localhost:" + server
.identity
.primaryPort
+ "/",
41 loadUsingSystemPrincipal
: true,
43 var targetFile
= Services
.dirsvc
.get("TmpD", Ci
.nsIFile
);
44 targetFile
.append("bug" + BUGID
+ ".test");
45 if (targetFile
.exists()) {
46 targetFile
.remove(false);
49 var downloader
= Cc
["@mozilla.org/network/downloader;1"].createInstance(
52 downloader
.init(listener
, targetFile
);
55 channel
.asyncOpen(downloader
);