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

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

Issue 1905873002: Add content_browsertests for testing cache control flags (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reload.html wasn't there Created 4 years, 7 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) 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 ASSERT(resource->canUseCacheValidator()); 537 ASSERT(resource->canUseCacheValidator());
538 ASSERT(!resource->isCacheValidator()); 538 ASSERT(!resource->isCacheValidator());
539 ASSERT(!context().isControlledByServiceWorker()); 539 ASSERT(!context().isControlledByServiceWorker());
540 540
541 ResourceRequest revalidatingRequest(resource->resourceRequest()); 541 ResourceRequest revalidatingRequest(resource->resourceRequest());
542 revalidatingRequest.clearHTTPReferrer(); 542 revalidatingRequest.clearHTTPReferrer();
543 initializeResourceRequest(revalidatingRequest, resource->getType(), request. defer()); 543 initializeResourceRequest(revalidatingRequest, resource->getType(), request. defer());
544 544
545 const AtomicString& lastModified = resource->response().httpHeaderField(HTTP Names::Last_Modified); 545 const AtomicString& lastModified = resource->response().httpHeaderField(HTTP Names::Last_Modified);
546 const AtomicString& eTag = resource->response().httpHeaderField(HTTPNames::E Tag); 546 const AtomicString& eTag = resource->response().httpHeaderField(HTTPNames::E Tag);
547 if (!lastModified.isEmpty() || !eTag.isEmpty()) {
548 ASSERT(context().getCachePolicy() != CachePolicyReload);
549 if (context().getCachePolicy() == CachePolicyRevalidate)
kinuko 2016/05/12 08:45:05 Hmm, it looks what we're changing here and the tes
Takashi Toyoshima 2016/05/13 05:27:13 I conformed that this code path is used for the im
550 revalidatingRequest.setHTTPHeaderField(HTTPNames::Cache_Control, "ma x-age=0");
551 }
552 if (!lastModified.isEmpty()) 547 if (!lastModified.isEmpty())
553 revalidatingRequest.setHTTPHeaderField(HTTPNames::If_Modified_Since, las tModified); 548 revalidatingRequest.setHTTPHeaderField(HTTPNames::If_Modified_Since, las tModified);
554 if (!eTag.isEmpty()) 549 if (!eTag.isEmpty())
555 revalidatingRequest.setHTTPHeaderField(HTTPNames::If_None_Match, eTag); 550 revalidatingRequest.setHTTPHeaderField(HTTPNames::If_None_Match, eTag);
556 551
557 double stalenessLifetime = resource->stalenessLifetime(); 552 double stalenessLifetime = resource->stalenessLifetime();
558 if (std::isfinite(stalenessLifetime) && stalenessLifetime > 0) { 553 if (std::isfinite(stalenessLifetime) && stalenessLifetime > 0) {
559 revalidatingRequest.setHTTPHeaderField(HTTPNames::Resource_Freshness, At omicString(String::format("max-age=%.0lf,stale-while-revalidate=%.0lf,age=%.0lf" , resource->freshnessLifetime(), stalenessLifetime, resource->currentAge()))); 554 revalidatingRequest.setHTTPHeaderField(HTTPNames::Resource_Freshness, At omicString(String::format("max-age=%.0lf,stale-while-revalidate=%.0lf,age=%.0lf" , resource->freshnessLifetime(), stalenessLifetime, resource->currentAge())));
560 } 555 }
561 556
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 visitor->trace(m_context); 1169 visitor->trace(m_context);
1175 visitor->trace(m_archive); 1170 visitor->trace(m_archive);
1176 visitor->trace(m_loaders); 1171 visitor->trace(m_loaders);
1177 visitor->trace(m_nonBlockingLoaders); 1172 visitor->trace(m_nonBlockingLoaders);
1178 visitor->trace(m_documentResources); 1173 visitor->trace(m_documentResources);
1179 visitor->trace(m_preloads); 1174 visitor->trace(m_preloads);
1180 visitor->trace(m_resourceTimingInfoMap); 1175 visitor->trace(m_resourceTimingInfoMap);
1181 } 1176 }
1182 1177
1183 } // namespace blink 1178 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698