Bug 1203430 - Intermittent crash in PNeckoChild::SendHTMLDNSPrefetch. r=jdm

This commit is contained in:
Jason Duell
2015-12-23 20:00:54 -05:00
parent d743918eb2
commit 09e835b8b0

View File

@@ -140,7 +140,10 @@ nsHTMLDNSPrefetch::Prefetch(const nsAString &hostname, uint16_t flags)
// considers empty strings to be valid hostnames // considers empty strings to be valid hostnames
if (!hostname.IsEmpty() && if (!hostname.IsEmpty() &&
net_IsValidHostName(NS_ConvertUTF16toUTF8(hostname))) { net_IsValidHostName(NS_ConvertUTF16toUTF8(hostname))) {
gNeckoChild->SendHTMLDNSPrefetch(nsAutoString(hostname), flags); // during shutdown gNeckoChild might be null
if (gNeckoChild) {
gNeckoChild->SendHTMLDNSPrefetch(nsAutoString(hostname), flags);
}
} }
return NS_OK; return NS_OK;
} }
@@ -197,8 +200,11 @@ nsHTMLDNSPrefetch::CancelPrefetch(const nsAString &hostname,
// considers empty strings to be valid hostnames // considers empty strings to be valid hostnames
if (!hostname.IsEmpty() && if (!hostname.IsEmpty() &&
net_IsValidHostName(NS_ConvertUTF16toUTF8(hostname))) { net_IsValidHostName(NS_ConvertUTF16toUTF8(hostname))) {
gNeckoChild->SendCancelHTMLDNSPrefetch(nsString(hostname), flags, // during shutdown gNeckoChild might be null
aReason); if (gNeckoChild) {
gNeckoChild->SendCancelHTMLDNSPrefetch(nsString(hostname), flags,
aReason);
}
} }
return NS_OK; return NS_OK;
} }
@@ -326,8 +332,11 @@ nsHTMLDNSPrefetch::nsDeferrals::SubmitQueue()
if (!hostName.IsEmpty() && NS_SUCCEEDED(rv) && !isLocalResource) { if (!hostName.IsEmpty() && NS_SUCCEEDED(rv) && !isLocalResource) {
if (IsNeckoChild()) { if (IsNeckoChild()) {
gNeckoChild->SendHTMLDNSPrefetch(NS_ConvertUTF8toUTF16(hostName), // during shutdown gNeckoChild might be null
mEntries[mTail].mFlags); if (gNeckoChild) {
gNeckoChild->SendHTMLDNSPrefetch(NS_ConvertUTF8toUTF16(hostName),
mEntries[mTail].mFlags);
}
} else { } else {
nsCOMPtr<nsICancelable> tmpOutstanding; nsCOMPtr<nsICancelable> tmpOutstanding;