Backed out 3 changesets (bug 1640091) for causing xpcshell failures in nsCOMPtr.h

CLOSED TREE

Backed out changeset 03c4c517ee37 (bug 1640091)
Backed out changeset a1d86c177d79 (bug 1640091)
Backed out changeset f481d4ec255a (bug 1640091)
This commit is contained in:
Mihai Alexandru Michis 2020-06-08 12:51:42 +03:00
Родитель d68a202c49
Коммит b0a610bce5
7 изменённых файлов: 10 добавлений и 148 удалений

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

@ -441,18 +441,11 @@ bool ProxyAutoConfig::ResolveAddress(const nsCString& aHostName,
RefPtr<PACResolver> helper = new PACResolver(mMainThreadEventTarget);
OriginAttributes attrs;
// When the PAC script attempts to resolve a domain, we must make sure we
// don't use TRR, otherwise the TRR channel might also attempt to resolve
// a name and we'll have a deadlock.
uint32_t flags =
nsIDNSService::RESOLVE_PRIORITY_MEDIUM |
nsIDNSService::GetFlagsFromTRRMode(nsIRequest::TRR_DISABLED_MODE);
if (NS_FAILED(dns->AsyncResolveNative(aHostName, flags, helper,
if (NS_FAILED(dns->AsyncResolveNative(
aHostName, nsIDNSService::RESOLVE_PRIORITY_MEDIUM, helper,
GetCurrentThreadEventTarget(), attrs,
getter_AddRefs(helper->mRequest)))) {
getter_AddRefs(helper->mRequest))))
return false;
}
if (aTimeout && helper->mRequest) {
if (!mTimer) mTimer = NS_NewTimer();

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

@ -20,12 +20,12 @@ namespace net {
// static
nsresult ProxyConfigLookup::Create(
std::function<void(nsIProxyInfo*, nsresult)>&& aCallback, nsIURI* aURI,
uint32_t aProxyResolveFlags, nsICancelable** aLookupCancellable) {
uint32_t aProxyResolveFlags) {
MOZ_ASSERT(NS_IsMainThread());
RefPtr<ProxyConfigLookup> lookUp =
new ProxyConfigLookup(std::move(aCallback), aURI, aProxyResolveFlags);
return lookUp->DoProxyResolve(aLookupCancellable);
return lookUp->DoProxyResolve();
}
ProxyConfigLookup::ProxyConfigLookup(
@ -37,7 +37,7 @@ ProxyConfigLookup::ProxyConfigLookup(
ProxyConfigLookup::~ProxyConfigLookup() = default;
nsresult ProxyConfigLookup::DoProxyResolve(nsICancelable** aLookupCancellable) {
nsresult ProxyConfigLookup::DoProxyResolve() {
if (!XRE_IsParentProcess()) {
RefPtr<ProxyConfigLookup> self = this;
bool result = ProxyConfigLookupChild::Create(
@ -77,10 +77,6 @@ nsresult ProxyConfigLookup::DoProxyResolve(nsICancelable** aLookupCancellable) {
getter_AddRefs(proxyRequest));
}
if (aLookupCancellable) {
proxyRequest.forget(aLookupCancellable);
}
return rv;
}

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

@ -22,15 +22,14 @@ class ProxyConfigLookup final : public nsIProtocolProxyCallback {
static nsresult Create(
std::function<void(nsIProxyInfo*, nsresult)>&& aCallback, nsIURI* aURI,
uint32_t aProxyResolveFlags,
nsICancelable** aLookupCancellable = nullptr);
uint32_t aProxyResolveFlags);
private:
explicit ProxyConfigLookup(
std::function<void(nsIProxyInfo*, nsresult)>&& aCallback, nsIURI* aURI,
uint32_t aProxyResolveFlags);
virtual ~ProxyConfigLookup();
nsresult DoProxyResolve(nsICancelable** aLookupCancellable);
nsresult DoProxyResolve();
std::function<void(nsIProxyInfo*, nsresult)> mCallback;
nsCOMPtr<nsIURI> mURI;

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

@ -252,7 +252,7 @@ nsresult TRRServiceChannel::ResolveProxy() {
[self](nsIProxyInfo* aProxyInfo, nsresult aStatus) {
self->OnProxyAvailable(nullptr, nullptr, aProxyInfo, aStatus);
},
mURI, mProxyResolveFlags, getter_AddRefs(mProxyRequest));
mURI, mProxyResolveFlags);
if (NS_FAILED(rv)) {
if (!mCurrentEventTarget->IsOnCurrentThread()) {

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

@ -68,7 +68,6 @@ function trr_clear_prefs() {
Services.prefs.clearUserPref("network.trr.excluded-domains");
Services.prefs.clearUserPref("network.trr.builtin-excluded-domains");
Services.prefs.clearUserPref("network.trr.clear-cache-on-pref-change");
Services.prefs.clearUserPref("network.trr.fetch_off_main_thread");
Services.prefs.clearUserPref("captivedetect.canonicalURL");
Services.prefs.clearUserPref("network.http.spdy.enabled");

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

@ -1,124 +0,0 @@
/* globals dnsResolve */
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
const { MockRegistrar } = ChromeUtils.import(
"resource://testing-common/MockRegistrar.jsm"
);
const dns = Cc["@mozilla.org/network/dns-service;1"].getService(
Ci.nsIDNSService
);
trr_test_setup();
registerCleanupFunction(async () => {
trr_clear_prefs();
});
function FindProxyForURL(url, host) {
alert(`PAC resolving: ${host}`);
alert(dnsResolve(host));
return "DIRECT";
}
const CID = Components.ID("{5645d2c1-d6d8-4091-b117-fe7ee4027db7}");
XPCOMUtils.defineLazyGetter(this, "systemSettings", function() {
return {
QueryInterface: ChromeUtils.generateQI(["nsISystemProxySettings"]),
mainThreadOnly: true,
PACURI: `data:application/x-ns-proxy-autoconfig;charset=utf-8,${encodeURIComponent(
FindProxyForURL.toString()
)}`,
getProxyForURI(aURI) {
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
};
});
const override = Cc["@mozilla.org/network/native-dns-override;1"].getService(
Ci.nsINativeDNSResolverOverride
);
add_task(async function test_pac_dnsResolve() {
Services.console.reset();
// Create a console listener.
let consolePromise = new Promise(resolve => {
let listener = {
observe(message) {
// Ignore unexpected messages.
if (!(message instanceof Ci.nsIConsoleMessage)) {
return;
}
if (message.message.includes("PAC file installed from")) {
Services.console.unregisterListener(listener);
resolve();
}
},
};
Services.console.registerListener(listener);
});
MockRegistrar.register(
"@mozilla.org/system-proxy-settings;1",
systemSettings
);
Services.prefs.setIntPref(
"network.proxy.type",
Ci.nsIProtocolProxyService.PROXYCONFIG_SYSTEM
);
let httpserv = new HttpServer();
httpserv.registerPathHandler("/", function handler(metadata, response) {
let content = "ok";
response.setHeader("Content-Length", `${content.length}`);
response.bodyOutputStream.write(content, content.length);
});
httpserv.start(-1);
Services.prefs.setBoolPref("network.dns.native-is-localhost", false);
Services.prefs.setIntPref("network.trr.mode", 0); // Disable TRR until the PAC is loaded
override.addIPOverride("example.org", "127.0.0.1");
let chan = NetUtil.newChannel({
uri: `http://example.org:${httpserv.identity.primaryPort}/`,
loadUsingSystemPrincipal: true,
}).QueryInterface(Ci.nsIHttpChannel);
await new Promise(resolve => chan.asyncOpen(new ChannelListener(resolve)));
await consolePromise;
let env = Cc["@mozilla.org/process/environment;1"].getService(
Ci.nsIEnvironment
);
let h2Port = env.get("MOZHTTP2_PORT");
Assert.notEqual(h2Port, null);
Assert.notEqual(h2Port, "");
override.addIPOverride("foo.example.com", "127.0.0.1");
Services.prefs.setCharPref(
"network.trr.uri",
`https://foo.example.com:${h2Port}/doh?responseIP=127.0.0.1`
);
async function test_with(DOMAIN, trrMode, fetchOffMainThread) {
Services.prefs.setIntPref("network.trr.mode", trrMode); // TRR first
Services.prefs.setBoolPref(
"network.trr.fetch_off_main_thread",
fetchOffMainThread
);
override.addIPOverride(DOMAIN, "127.0.0.1");
chan = NetUtil.newChannel({
uri: `http://${DOMAIN}:${httpserv.identity.primaryPort}/`,
loadUsingSystemPrincipal: true,
}).QueryInterface(Ci.nsIHttpChannel);
await new Promise(resolve => chan.asyncOpen(new ChannelListener(resolve)));
await override.clearHostOverride(DOMAIN);
}
await test_with("test1.com", 2, true);
await test_with("test2.com", 3, true);
await test_with("test3.com", 2, false);
await test_with("test4.com", 3, false);
await httpserv.stop();
});

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

@ -433,4 +433,3 @@ skip-if = true || asan || tsan || os == 'win' || os =='android'
[test_trr_httpssvc.js]
[test_trr_case_sensitivity.js]
skip-if = os == "android" || verify
[test_trr_proxy.js]