3 const { HttpServer
} = ChromeUtils
.importESModule(
4 "resource://testing-common/httpd.sys.mjs"
9 function make_channel(url
) {
10 return NetUtil
.newChannel({
12 loadUsingSystemPrincipal
: true,
16 const responseBody
= "response body";
18 function contentHandler(metadata
, response
) {
19 response
.setHeader("Content-Type", "text/plain");
20 response
.bodyOutputStream
.write(responseBody
, responseBody
.length
);
23 function finish_test(request
, buffer
) {
24 Assert
.equal(buffer
, "");
25 httpServer
.stop(do_test_finished
);
29 httpServer
= new HttpServer();
30 httpServer
.registerPathHandler("/content", contentHandler
);
33 // we want to cancel the failover proxy engage, so, do not allow
34 // redirects from now.
36 var nc
= new ChannelEventSink();
37 nc
._flags
= ES_ABORT_REDIRECT
;
39 var prefs
= Services
.prefs
.getBranch("network.proxy.");
40 prefs
.setIntPref("type", 2);
41 prefs
.setCharPref("no_proxies_on", "nothing");
42 prefs
.setBoolPref("allow_hijacking_localhost", true);
46 "function FindProxyForURL(url, host) {return 'PROXY a_non_existent_domain_x7x6c572v:80; PROXY localhost:" +
47 httpServer
.identity
.primaryPort
+
51 var chan
= make_channel(
52 "http://localhost:" + httpServer
.identity
.primaryPort
+ "/content"
54 chan
.notificationCallbacks
= nc
;
55 chan
.asyncOpen(new ChannelListener(finish_test
, null, CL_EXPECT_FAILURE
));