Bug 1722942 use beConservative for proxy failover to direct r=dragana,necko-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D121234
This commit is contained in:
Shane Caraveo 2021-08-10 16:29:06 +00:00
Родитель afdc2b3bcc
Коммит 728ee84a7d
2 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -2652,9 +2652,8 @@ nsresult nsHttpChannel::ProxyFailover() {
return rv;
}
// If this request used a failed proxy and there is no failover available,
// fallback to DIRECT connections for system principal requests.
if (mLoadInfo->GetLoadingPrincipal() &&
mLoadInfo->GetLoadingPrincipal()->IsSystemPrincipal()) {
// fallback to DIRECT connections for conservative requests.
if (LoadBeConservative()) {
rv = pps->NewProxyInfo("direct"_ns, ""_ns, 0, ""_ns, ""_ns, 0, UINT32_MAX,
nullptr, getter_AddRefs(pi));
}

Просмотреть файл

@ -42,8 +42,9 @@ function getBadProxyPort() {
function xhr(url) {
return new Promise((resolve, reject) => {
let req = new XMLHttpRequest({ mozSystem: true });
let req = new XMLHttpRequest();
req.open("GET", `${url}?t=${Math.random()}`);
req.channel.QueryInterface(Ci.nsIHttpChannelInternal).beConservative = true;
req.onload = () => {
resolve(req.responseText);
};