Bug 1098415 - Skip DNS prefetch requests that point to local resources. r=sworkman r=dragana

This commit is contained in:
Jeff Lu 2015-03-12 09:00:00 +01:00
parent 18a6151b7a
commit 6ce5d89ed6

View File

@ -852,9 +852,15 @@ nsContentSink::PrefetchDNS(const nsAString &aHref)
if (!uri) {
return;
}
nsAutoCString host;
uri->GetHost(host);
CopyUTF8toUTF16(host, hostname);
nsresult rv;
bool isLocalResource = false;
rv = NS_URIChainHasFlags(uri, nsIProtocolHandler::URI_IS_LOCAL_RESOURCE,
&isLocalResource);
if (NS_SUCCEEDED(rv) && !isLocalResource) {
nsAutoCString host;
uri->GetHost(host);
CopyUTF8toUTF16(host, hostname);
}
}
if (!hostname.IsEmpty() && nsHTMLDNSPrefetch::IsAllowed(mDocument)) {