blob: 216963ec19b5f1b4905058522bc202b8d9bc4b18 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
"use strict";
/* global NetUtil, ChannelListener, CL_ALLOW_UNKNOWN_CL */
add_task(async function check_proxy() {
do_send_remote_message("start-test");
let URL = await do_await_remote_message("start-test-done");
let chan = NetUtil.newChannel({
uri: URL,
loadUsingSystemPrincipal: true,
}).QueryInterface(Ci.nsIHttpChannel);
let { req, buff } = await channelOpenPromise(chan, CL_ALLOW_UNKNOWN_CL);
equal(buff, "content");
equal(req.QueryInterface(Ci.nsIHttpChannelInternal).isProxyUsed, true);
});
function channelOpenPromise(chan, flags) {
return new Promise(resolve => {
chan.asyncOpen(
new ChannelListener((req, buff) => resolve({ req, buff }), null, flags)
);
});
}
|