Follow-on fix for bug 457825. Use sheet principal for agent and user sheets. r=dbaron...
[wine-gecko.git] / netwerk / test / unit / test_bug263127.js
blob4156cf7cc74ba4067c9fe6e73d8a4e8d424aed07
1 do_import_script("netwerk/test/httpserver/httpd.js");
3 var server;
4 const BUGID = "263127";
6 var listener = {
7   QueryInterface: function(iid) {
8     if (!iid.equals(nsIDownloadObserver) &&
9         !iid.equals(nsISupports))
10       throw Components.results.NS_ERROR_NO_INTERFACE;
12     return this;
13   },
15   onDownloadComplete: function(downloader, request, ctxt, status, file) {
16     server.stop();
18     if (!file)
19       do_throw("Download failed");
21     try {
22       file.remove(false);
23     }
24     catch (e) {
25       do_throw(e);
26     }
28     do_check_false(file.exists());
30     do_test_finished();
31   }
34 function run_test() {
35   // start server
36   server = new nsHttpServer();
37   server.start(4444);
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);
55   // Start download
56   channel.asyncOpen(downloader, null);
58   do_test_pending();