Loading content/base/src/nsContentSink.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,8 @@ #include "nsIDocumentLoader.h" #include "nsICachingChannel.h" #include "nsICacheEntryDescriptor.h" #include "nsGenericHTMLElement.h" #include "nsHTMLDNSPrefetch.h" PRLogModuleInfo* gContentSinkLogModuleInfo; Loading Loading @@ -722,6 +724,10 @@ nsContentSink::ProcessLink(nsIContent* aElement, PrefetchHref(aHref, aElement, hasPrefetch); } if ((!aHref.IsEmpty()) && linkTypes.IndexOf(NS_LITERAL_STRING("dns-prefetch")) != -1) { PrefetchDNS(aHref); } // is it a stylesheet link? if (linkTypes.IndexOf(NS_LITERAL_STRING("stylesheet")) == -1) { return NS_OK; Loading Loading @@ -853,6 +859,23 @@ nsContentSink::PrefetchHref(const nsAString &aHref, } } void nsContentSink::PrefetchDNS(const nsAString &aHref) { nsAutoString hostname; if (StringBeginsWith(aHref, NS_LITERAL_STRING("//"))) { hostname = Substring(aHref, 2); } else nsGenericHTMLElement::GetHostnameFromHrefString(aHref, hostname); nsRefPtr<nsHTMLDNSPrefetch> prefetch = new nsHTMLDNSPrefetch(hostname, mDocument); if (prefetch) { prefetch->PrefetchLow(); } } nsresult nsContentSink::GetChannelCacheKey(nsIChannel* aChannel, nsACString& aCacheKey) { Loading content/base/src/nsContentSink.h +4 −0 Original line number Diff line number Diff line Loading @@ -195,6 +195,10 @@ protected: void PrefetchHref(const nsAString &aHref, nsIContent *aSource, PRBool aExplicit); // aHref can either be the usual URI format or of the form "//www.hostname.com" // without a scheme. void PrefetchDNS(const nsAString &aHref); // Gets the cache key (used to identify items in a cache) of the channel. nsresult GetChannelCacheKey(nsIChannel* aChannel, nsACString& aCacheKey); Loading content/base/src/nsDocument.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -6572,6 +6572,7 @@ nsDocument::RetrieveRelevantHeaders(nsIChannel *aChannel) "content-language", "content-disposition", "refresh", "x-dns-prefetch-control", // add more http headers if you need // XXXbz don't add content-location support without reading bug // 238654 and its dependencies/dups first. Loading content/base/src/nsGkAtomList.h +1 −0 Original line number Diff line number Diff line Loading @@ -987,6 +987,7 @@ GK_ATOM(headerWindowTarget, "window-target") GK_ATOM(withParam, "with-param") GK_ATOM(wizard, "wizard") GK_ATOM(wrap, "wrap") GK_ATOM(headerDNSPrefetchControl,"x-dns-prefetch-control") GK_ATOM(xml, "xml") GK_ATOM(xmlns, "xmlns") GK_ATOM(xmp, "xmp") Loading content/html/content/src/Makefile.in +1 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ EXPORTS = \ CPPSRCS = \ nsClientRect.cpp \ nsHTMLDNSPrefetch.cpp \ nsGenericHTMLElement.cpp \ nsFormSubmission.cpp \ nsImageMapUtils.cpp \ Loading Loading
content/base/src/nsContentSink.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,8 @@ #include "nsIDocumentLoader.h" #include "nsICachingChannel.h" #include "nsICacheEntryDescriptor.h" #include "nsGenericHTMLElement.h" #include "nsHTMLDNSPrefetch.h" PRLogModuleInfo* gContentSinkLogModuleInfo; Loading Loading @@ -722,6 +724,10 @@ nsContentSink::ProcessLink(nsIContent* aElement, PrefetchHref(aHref, aElement, hasPrefetch); } if ((!aHref.IsEmpty()) && linkTypes.IndexOf(NS_LITERAL_STRING("dns-prefetch")) != -1) { PrefetchDNS(aHref); } // is it a stylesheet link? if (linkTypes.IndexOf(NS_LITERAL_STRING("stylesheet")) == -1) { return NS_OK; Loading Loading @@ -853,6 +859,23 @@ nsContentSink::PrefetchHref(const nsAString &aHref, } } void nsContentSink::PrefetchDNS(const nsAString &aHref) { nsAutoString hostname; if (StringBeginsWith(aHref, NS_LITERAL_STRING("//"))) { hostname = Substring(aHref, 2); } else nsGenericHTMLElement::GetHostnameFromHrefString(aHref, hostname); nsRefPtr<nsHTMLDNSPrefetch> prefetch = new nsHTMLDNSPrefetch(hostname, mDocument); if (prefetch) { prefetch->PrefetchLow(); } } nsresult nsContentSink::GetChannelCacheKey(nsIChannel* aChannel, nsACString& aCacheKey) { Loading
content/base/src/nsContentSink.h +4 −0 Original line number Diff line number Diff line Loading @@ -195,6 +195,10 @@ protected: void PrefetchHref(const nsAString &aHref, nsIContent *aSource, PRBool aExplicit); // aHref can either be the usual URI format or of the form "//www.hostname.com" // without a scheme. void PrefetchDNS(const nsAString &aHref); // Gets the cache key (used to identify items in a cache) of the channel. nsresult GetChannelCacheKey(nsIChannel* aChannel, nsACString& aCacheKey); Loading
content/base/src/nsDocument.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -6572,6 +6572,7 @@ nsDocument::RetrieveRelevantHeaders(nsIChannel *aChannel) "content-language", "content-disposition", "refresh", "x-dns-prefetch-control", // add more http headers if you need // XXXbz don't add content-location support without reading bug // 238654 and its dependencies/dups first. Loading
content/base/src/nsGkAtomList.h +1 −0 Original line number Diff line number Diff line Loading @@ -987,6 +987,7 @@ GK_ATOM(headerWindowTarget, "window-target") GK_ATOM(withParam, "with-param") GK_ATOM(wizard, "wizard") GK_ATOM(wrap, "wrap") GK_ATOM(headerDNSPrefetchControl,"x-dns-prefetch-control") GK_ATOM(xml, "xml") GK_ATOM(xmlns, "xmlns") GK_ATOM(xmp, "xmp") Loading
content/html/content/src/Makefile.in +1 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ EXPORTS = \ CPPSRCS = \ nsClientRect.cpp \ nsHTMLDNSPrefetch.cpp \ nsGenericHTMLElement.cpp \ nsFormSubmission.cpp \ nsImageMapUtils.cpp \ Loading