Bug 473974. Don't DNS-prefetch nodes whose document went away. r+sr=bzbarsky

This commit is contained in:
Patrick McManus 2009-01-16 14:21:32 -05:00
parent dbd10e746e
commit a6550e3070

View File

@ -282,18 +282,22 @@ nsHTMLDNSPrefetch::nsDeferrals::SubmitQueue()
if (!sDNSService) return;
while (mHead != mTail) {
nsCOMPtr<nsIURI> hrefURI;
mEntries[mTail].mElement->GetHrefURIForAnchors(getter_AddRefs(hrefURI));
if (hrefURI)
hrefURI->GetAsciiHost(hostName);
if (!hostName.IsEmpty()) {
nsCOMPtr<nsICancelable> tmpOutstanding;
sDNSService->AsyncResolve(hostName,
mEntries[mTail].mFlags,
sDNSListener, nsnull, getter_AddRefs(tmpOutstanding));
if (mEntries[mTail].mElement->GetOwnerDoc()) {
nsCOMPtr<nsIURI> hrefURI;
mEntries[mTail].mElement->GetHrefURIForAnchors(getter_AddRefs(hrefURI));
if (hrefURI)
hrefURI->GetAsciiHost(hostName);
if (!hostName.IsEmpty()) {
nsCOMPtr<nsICancelable> tmpOutstanding;
sDNSService->AsyncResolve(hostName,
mEntries[mTail].mFlags,
sDNSListener, nsnull, getter_AddRefs(tmpOutstanding));
}
}
mEntries[mTail].mElement = nsnull;
mTail = (mTail + 1) & sMaxDeferredMask;
}