1 do_import_script("netwerk/test/httpserver/httpd.js");
4 const BUGID = "263127";
7 QueryInterface: function(iid) {
8 if (!iid.equals(nsIDownloadObserver) &&
9 !iid.equals(nsISupports))
10 throw Components.results.NS_ERROR_NO_INTERFACE;
15 onDownloadComplete: function(downloader, request, ctxt, status, file) {
19 do_throw("Download failed");
28 do_check_false(file.exists());
36 server = new nsHttpServer();
39 // Initialize downloader
40 var channel = Cc["@mozilla.org/network/io-service;1"]
41 .getService(Ci.nsIIOService)
42 .newChannel("http://localhost:4444/", null, null);
44 var targetFile = Cc["@mozilla.org/file/directory_service;1"]
45 .getService(Ci.nsIProperties)
46 .get("TmpD", Ci.nsIFile);
47 targetFile.append("bug" + BUGID + ".test");
48 if (targetFile.exists())
49 targetFile.remove(false);
51 var downloader = Cc["@mozilla.org/network/downloader;1"]
52 .createInstance(Ci.nsIDownloader);
53 downloader.init(listener, targetFile);
56 channel.asyncOpen(downloader, null);