3 const { HttpServer
} = ChromeUtils
.importESModule(
4 "resource://testing-common/httpd.sys.mjs"
9 function make_channel(url
) {
10 return NetUtil
.newChannel({ uri
: url
, loadUsingSystemPrincipal
: true });
13 const responseBody
= "response body";
15 function contentHandler(metadata
, response
) {
16 response
.setHeader("Content-Type", "text/plain");
17 response
.bodyOutputStream
.write(responseBody
, responseBody
.length
);
20 function finish_test(request
, buffer
) {
21 Assert
.equal(buffer
, responseBody
);
22 httpServer
.stop(do_test_finished
);
26 httpServer
= new HttpServer();
27 httpServer
.registerPathHandler("/content", contentHandler
);
30 var prefs
= Services
.prefs
.getBranch("network.proxy.");
31 prefs
.setIntPref("type", 2);
35 "function FindProxyForURL(url, host) {return 'PROXY a_non_existent_domain_x7x6c572v:80; PROXY localhost:" +
36 httpServer
.identity
.primaryPort
+
40 var chan
= make_channel(
41 "http://localhost:" + httpServer
.identity
.primaryPort
+ "/content"
43 chan
.asyncOpen(new ChannelListener(finish_test
, null));