From c31d7cf9973ead1e76f04d81f455310142e8ec9f Mon Sep 17 00:00:00 2001 From: Jeff Lu Date: Thu, 12 Mar 2015 09:00:00 +0100 Subject: [PATCH] Bug 1098415 - Skip DNS prefetch requests that point to local resources. r=sworkman r=dragana --- dom/base/nsContentSink.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dom/base/nsContentSink.cpp b/dom/base/nsContentSink.cpp index f486bf74d757..8ef3c075275a 100644 --- a/dom/base/nsContentSink.cpp +++ b/dom/base/nsContentSink.cpp @@ -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)) {