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

Unified Diff: Source/core/loader/ImageLoader.cpp

Issue 1112513005: Reload image bypassing the cache (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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
Index: Source/core/loader/ImageLoader.cpp
diff --git a/Source/core/loader/ImageLoader.cpp b/Source/core/loader/ImageLoader.cpp
index ecb7d10eda0468355d192b96f704e1363bb43391..73b07364414860bd2e0e53cef7a4092cd1e3921c 100644
--- a/Source/core/loader/ImageLoader.cpp
+++ b/Source/core/loader/ImageLoader.cpp
@@ -100,7 +100,7 @@ public:
if (Heap::willObjectBeLazilySwept(m_loader))
return;
#endif
- m_loader->doUpdateFromElement(m_shouldBypassMainWorldCSP, m_updateBehavior);
+ m_loader->doUpdateFromElement(m_shouldBypassMainWorldCSP, m_updateBehavior, false);
Yoav Weiss 2015/04/29 06:13:24 This shouldn't be a boolean, but an enum. That way
}
}
@@ -237,7 +237,7 @@ inline void ImageLoader::enqueueImageLoadingMicroTask(UpdateFromElementBehavior
m_loadDelayCounter = IncrementLoadEventDelayCount::create(m_element->document());
}
-void ImageLoader::doUpdateFromElement(BypassMainWorldBehavior bypassBehavior, UpdateFromElementBehavior updateBehavior)
+void ImageLoader::doUpdateFromElement(BypassMainWorldBehavior bypassBehavior, UpdateFromElementBehavior updateBehavior, bool bypassCache)
{
// FIXME: According to
// http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content.html#the-img-element:the-img-element-55
@@ -265,6 +265,8 @@ void ImageLoader::doUpdateFromElement(BypassMainWorldBehavior bypassBehavior, Up
ResourceLoaderOptions resourceLoaderOptions = ResourceFetcher::defaultResourceOptions();
ResourceRequest resourceRequest(url);
resourceRequest.setFetchCredentialsMode(WebURLRequest::FetchCredentialsModeSameOrigin);
+ if (bypassCache)
+ resourceRequest.setCachePolicy(ResourceRequestCachePolicy::ReloadBypassingCache);
Nate Chapin 2015/04/30 20:59:41 I'm not thrilled with the need to bypass the cache
megjablon 2015/04/30 22:00:54 We discussed using no-store, but want LoFi images
Nate Chapin 2015/04/30 22:26:54 LoFi images would be replaced with the real image
megjablon 2015/04/30 22:35:50 Yes, we want to only replace one real image at a t
if (isHTMLPictureElement(element()->parentNode()) || !element()->fastGetAttribute(HTMLNames::srcsetAttr).isNull())
resourceRequest.setRequestContext(WebURLRequest::RequestContextImageSet);
FetchRequest request(resourceRequest, element()->localName(), resourceLoaderOptions);
@@ -340,7 +342,7 @@ void ImageLoader::doUpdateFromElement(BypassMainWorldBehavior bypassBehavior, Up
updatedHasPendingEvent();
}
-void ImageLoader::updateFromElement(UpdateFromElementBehavior updateBehavior)
+void ImageLoader::updateFromElement(UpdateFromElementBehavior updateBehavior, bool bypassCache)
{
AtomicString imageSourceURL = m_element->imageSourceURL();
m_suppressErrorEvents = (updateBehavior == UpdateSizeChanged);
@@ -360,7 +362,7 @@ void ImageLoader::updateFromElement(UpdateFromElementBehavior updateBehavior)
KURL url = imageSourceToKURL(imageSourceURL);
if (shouldLoadImmediately(url)) {
- doUpdateFromElement(DoNotBypassMainWorldCSP, updateBehavior);
+ doUpdateFromElement(DoNotBypassMainWorldCSP, updateBehavior, bypassCache);
return;
}
// Allow the idiom "img.src=''; img.src='.." to clear down the image before

Powered by Google App Engine
This is Rietveld 408576698