1 do_import_script("netwerk/test/httpserver/httpd.js");
3 const BUGID
= "369787";
7 function change_content_type() {
8 var origType
= channel
.contentType
;
9 const newType
= "x-foo/x-bar";
10 channel
.contentType
= newType
;
11 do_check_eq(channel
.contentType
, newType
);
12 channel
.contentType
= origType
;
13 do_check_eq(channel
.contentType
, origType
);
16 function TestListener() {
18 TestListener
.prototype.onStartRequest = function(request
, context
) {
19 change_content_type();
21 TestListener
.prototype.onStopRequest = function(request
, context
, status
) {
22 change_content_type();
24 do_timeout(0, "after_channel_closed()");
27 function after_channel_closed() {
29 change_content_type();
38 server
= new nsHttpServer();
40 server
.registerPathHandler("/bug" + BUGID
, bug369787
);
46 Components
.classes
["@mozilla.org/network/io-service;1"].
47 getService(Components
.interfaces
.nsIIOService
).
48 newChannel("http://localhost:4444/bug" + BUGID
, null, null);
50 channel
.QueryInterface(Components
.interfaces
.nsIHttpChannel
);
51 channel
.asyncOpen(new TestListener(), null);
56 // PATH HANDLER FOR /bug369787
57 function bug369787(metadata
, response
) {