зеркало из https://github.com/mozilla/gecko-dev.git
Bug 577073 - Make nsPACMan respect network.dns.disablePrefetch, don't call NS_RELEASE_THIS() before Complete(). r=bz
This commit is contained in:
Родитель
4067a61b6f
Коммит
8de4de07db
|
@ -89,7 +89,7 @@ public:
|
|||
PR_INIT_CLIST(this);
|
||||
}
|
||||
|
||||
nsresult Start();
|
||||
nsresult Start(PRUint32 flags);
|
||||
void Complete(nsresult status, const nsCString &pacString);
|
||||
|
||||
private:
|
||||
|
@ -103,7 +103,7 @@ private:
|
|||
NS_IMPL_THREADSAFE_ISUPPORTS1(PendingPACQuery, nsIDNSListener)
|
||||
|
||||
nsresult
|
||||
PendingPACQuery::Start()
|
||||
PendingPACQuery::Start(PRUint32 flags)
|
||||
{
|
||||
if (mDNSRequest)
|
||||
return NS_OK; // already started
|
||||
|
@ -120,7 +120,7 @@ PendingPACQuery::Start()
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = dns->AsyncResolve(host, 0, this, NS_GetCurrentThread(),
|
||||
rv = dns->AsyncResolve(host, flags, this, NS_GetCurrentThread(),
|
||||
getter_AddRefs(mDNSRequest));
|
||||
if (NS_FAILED(rv))
|
||||
NS_WARNING("DNS AsyncResolve failed");
|
||||
|
@ -160,11 +160,12 @@ PendingPACQuery::OnLookupComplete(nsICancelable *request,
|
|||
|
||||
// We're no longer pending, so we can remove ourselves.
|
||||
PR_REMOVE_LINK(this);
|
||||
NS_RELEASE_THIS();
|
||||
|
||||
nsCAutoString pacString;
|
||||
status = mPACMan->GetProxyForURI(mURI, pacString);
|
||||
Complete(status, pacString);
|
||||
|
||||
NS_RELEASE_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -238,11 +239,16 @@ nsPACMan::AsyncGetProxyForURI(nsIURI *uri, nsPACManCallback *callback)
|
|||
// away since we know the result will be DIRECT. We could shortcut some code
|
||||
// in this case by issuing the callback directly from here, but that would
|
||||
// require extra code, so we just go through the usual async code path.
|
||||
if (IsLoading() && !IsPACURI(uri))
|
||||
int isPACURI = IsPACURI(uri);
|
||||
|
||||
if (IsLoading() && !isPACURI)
|
||||
return NS_OK;
|
||||
|
||||
nsresult rv = query->Start();
|
||||
if (NS_FAILED(rv)) {
|
||||
nsresult rv = query->Start(isPACURI ? 0 : nsIDNSService::RESOLVE_SPECULATE);
|
||||
if (rv == NS_ERROR_DNS_LOOKUP_QUEUE_FULL && !isPACURI) {
|
||||
query->OnLookupComplete(NULL, NULL, NS_OK);
|
||||
rv = NS_OK;
|
||||
} else if (NS_FAILED(rv)) {
|
||||
NS_WARNING("failed to start PAC query");
|
||||
PR_REMOVE_LINK(query);
|
||||
NS_RELEASE(query);
|
||||
|
@ -379,9 +385,12 @@ nsPACMan::ProcessPendingQ(nsresult status)
|
|||
if (NS_SUCCEEDED(status)) {
|
||||
// keep the query in the list (so we can complete it from Shutdown if
|
||||
// necessary).
|
||||
status = query->Start();
|
||||
status = query->Start(nsIDNSService::RESOLVE_SPECULATE);
|
||||
}
|
||||
if (NS_FAILED(status)) {
|
||||
if (status == NS_ERROR_DNS_LOOKUP_QUEUE_FULL) {
|
||||
query->OnLookupComplete(NULL, NULL, NS_OK);
|
||||
status = NS_OK;
|
||||
} else if (NS_FAILED(status)) {
|
||||
// remove the query from the list
|
||||
PR_REMOVE_LINK(query);
|
||||
query->Complete(status, EmptyCString());
|
||||
|
|
Загрузка…
Ссылка в новой задаче