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

Side by Side Diff: third_party/WebKit/Source/core/loader/LinkLoader.cpp

Issue 2160403002: Dont preload from link headers if the response came from MemoryCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 { 306 {
307 if (!document || headerValue.isEmpty()) 307 if (!document || headerValue.isEmpty())
308 return; 308 return;
309 LinkHeaderSet headerSet(headerValue); 309 LinkHeaderSet headerSet(headerValue);
310 for (auto& header : headerSet) { 310 for (auto& header : headerSet) {
311 if (!header.valid() || header.url().isEmpty() || header.rel().isEmpty()) 311 if (!header.valid() || header.url().isEmpty() || header.rel().isEmpty())
312 continue; 312 continue;
313 313
314 LinkRelAttribute relAttribute(header.rel()); 314 LinkRelAttribute relAttribute(header.rel());
315 KURL url(baseURL, header.url()); 315 KURL url(baseURL, header.url());
316 // Sanity check to avoid re-entrancy here.
317 if (url == baseURL)
318 continue;
Yoav Weiss 2016/07/19 21:14:22 Is this specific to MemoryCache? Seems like if I'm
Charlie Harrison 2016/07/19 21:23:52 Ah no this isn't specific to memory cache. I added
Yoav Weiss 2016/07/19 21:29:48 I don't think you should remove it. I'm probably m
316 if (canLoadResources != OnlyLoadResources) { 319 if (canLoadResources != OnlyLoadResources) {
317 if (RuntimeEnabledFeatures::linkHeaderEnabled()) 320 if (RuntimeEnabledFeatures::linkHeaderEnabled())
318 dnsPrefetchIfNeeded(relAttribute, url, *document, networkHintsIn terface, LinkCalledFromHeader); 321 dnsPrefetchIfNeeded(relAttribute, url, *document, networkHintsIn terface, LinkCalledFromHeader);
319 322
320 if (RuntimeEnabledFeatures::linkPreconnectEnabled()) 323 if (RuntimeEnabledFeatures::linkPreconnectEnabled())
321 preconnectIfNeeded(relAttribute, url, *document, crossOriginAttr ibuteValue(header.crossOrigin()), networkHintsInterface, LinkCalledFromHeader); 324 preconnectIfNeeded(relAttribute, url, *document, crossOriginAttr ibuteValue(header.crossOrigin()), networkHintsInterface, LinkCalledFromHeader);
322 } 325 }
323 if (canLoadResources != DoNotLoadResources) { 326 if (canLoadResources != DoNotLoadResources) {
324 bool errorOccurred = false; 327 bool errorOccurred = false;
325 if (RuntimeEnabledFeatures::linkPreloadEnabled()) { 328 if (RuntimeEnabledFeatures::linkPreloadEnabled()) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 DEFINE_TRACE(LinkLoader) 396 DEFINE_TRACE(LinkLoader)
394 { 397 {
395 visitor->trace(m_client); 398 visitor->trace(m_client);
396 visitor->trace(m_prerender); 399 visitor->trace(m_prerender);
397 visitor->trace(m_linkPreloadResourceClient); 400 visitor->trace(m_linkPreloadResourceClient);
398 ResourceOwner<Resource, ResourceClient>::trace(visitor); 401 ResourceOwner<Resource, ResourceClient>::trace(visitor);
399 PrerenderClient::trace(visitor); 402 PrerenderClient::trace(visitor);
400 } 403 }
401 404
402 } // namespace blink 405 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698