Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Unified Diff: components/network_hints/renderer/renderer_dns_prefetch.cc

Issue 1007323003: DNS Prefetch fix: renderer shouldn't send long hostnames to browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/predictor/dns_prefetch.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/network_hints/renderer/renderer_dns_prefetch.cc
diff --git a/components/network_hints/renderer/renderer_dns_prefetch.cc b/components/network_hints/renderer/renderer_dns_prefetch.cc
index a9326b67cdf2e8494edc7cd6c2eed4ffe7c9ceaa..a1c38af5c92b2abf08e5b9a1fbd978d233309855 100644
--- a/components/network_hints/renderer/renderer_dns_prefetch.cc
+++ b/components/network_hints/renderer/renderer_dns_prefetch.cc
@@ -130,20 +130,23 @@ void RendererDnsPrefetch::ExtractBufferedNames(size_t size_goal) {
void RendererDnsPrefetch::DnsPrefetchNames(size_t max_count) {
// We are on the renderer thread, and just need to send things to the browser.
NameList names;
+ size_t domains_handled = 0;
for (DomainUseMap::iterator it = domain_map_.begin();
it != domain_map_.end();
++it) {
if (0 == (it->second & kLookupRequested)) {
it->second |= kLookupRequested;
- names.push_back(it->first);
+ domains_handled++;
+ if (it->first.length() <= network_hints::kMaxDnsHostnameLength)
+ names.push_back(it->first);
if (0 == max_count) continue; // Get all, independent of count.
if (1 == max_count) break;
--max_count;
DCHECK_GE(max_count, 1u);
}
}
- DCHECK_GE(new_name_count_, names.size());
- new_name_count_ -= names.size();
+ DCHECK_GE(new_name_count_, domains_handled);
+ new_name_count_ -= domains_handled;
network_hints::LookupRequest request;
request.hostname_list = names;
« no previous file with comments | « chrome/test/data/predictor/dns_prefetch.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698