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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp

Issue 2341893002: Don't attempt to revalidate a Resource with a 304 response. (Closed)
Patch Set: Move fix to ResourceFetcher::determineRevalidationPolicy, test to ResourceFetcherTest Created 4 years, 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 return Reload; 698 return Reload;
699 699
700 // If resource was populated from a SubstituteData load or data: url, use it . 700 // If resource was populated from a SubstituteData load or data: url, use it .
701 if (isStaticData) 701 if (isStaticData)
702 return Use; 702 return Use;
703 703
704 if (!existingResource->canReuse(request)) 704 if (!existingResource->canReuse(request))
705 return Reload; 705 return Reload;
706 706
707 // Certain requests (e.g., XHRs) might have manually set headers that requir e revalidation. 707 // Certain requests (e.g., XHRs) might have manually set headers that requir e revalidation.
708 // FIXME: In theory, this should be a Revalidate case. In practice, the Memo ryCache revalidation path assumes a whole bunch 708 // In theory, this should be a Revalidate case. In practice, the MemoryCache revalidation path assumes a whole bunch
709 // of things about how revalidation works that manual headers violate, so pu nt to Reload instead. 709 // of things about how revalidation works that manual headers violate, so pu nt to Reload instead.
710 if (request.isConditional()) 710 //
711 // Similarly, a request with manually added revalidation headers can lead
712 // to a 304 response for a request that wasn't flagged as a revalidation
713 // attempt. Normally, successful revalidation will maintain the original
714 // response's status code, but for a manual revalidation the response code
715 // aremains 304. In this case, the Resource likely has insufficient context
hiroshige 2016/09/23 16:00:19 nit: s/aremains/remains/?
Nate Chapin 2016/09/23 20:45:51 Done.
716 // to provide a useful revalidation.
hiroshige 2016/09/23 16:00:19 This looks like this condition is only for prevent
hiroshige 2016/09/23 16:00:19 Could you refer to the crbug entry to provide more
Nate Chapin 2016/09/23 20:45:50 Done.
Nate Chapin 2016/09/23 20:45:50 Done.
717 if (request.isConditional() || existingResource->response().httpStatusCode() == 304)
711 return Reload; 718 return Reload;
712 719
713 // Don't try to reuse an in-progress async request for a new sync request. 720 // Don't try to reuse an in-progress async request for a new sync request.
714 if (fetchRequest.options().synchronousPolicy == RequestSynchronously && exis tingResource->isLoading()) 721 if (fetchRequest.options().synchronousPolicy == RequestSynchronously && exis tingResource->isLoading())
715 return Reload; 722 return Reload;
716 723
717 // Don't reload resources while pasting. 724 // Don't reload resources while pasting.
718 if (m_allowStaleResources) 725 if (m_allowStaleResources)
719 return Use; 726 return Use;
720 727
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 visitor->trace(m_context); 1344 visitor->trace(m_context);
1338 visitor->trace(m_archive); 1345 visitor->trace(m_archive);
1339 visitor->trace(m_loaders); 1346 visitor->trace(m_loaders);
1340 visitor->trace(m_nonBlockingLoaders); 1347 visitor->trace(m_nonBlockingLoaders);
1341 visitor->trace(m_documentResources); 1348 visitor->trace(m_documentResources);
1342 visitor->trace(m_preloads); 1349 visitor->trace(m_preloads);
1343 visitor->trace(m_resourceTimingInfoMap); 1350 visitor->trace(m_resourceTimingInfoMap);
1344 } 1351 }
1345 1352
1346 } // namespace blink 1353 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698