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

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

Issue 2105283002: <image>'s src URL is resolved incorrectly when <base> element dynamically added (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: <image>'s src URL is resolved incorrectly when <base> element dynamically added. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/loader/ImageLoader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/ImageLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/ImageLoader.cpp b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
index 4f38a210caddd5649018f6609105dd1e551ac782..ca60c9537a52dca840ed6f76f24495be40c83580 100644
--- a/third_party/WebKit/Source/core/loader/ImageLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
@@ -107,6 +107,7 @@ public:
m_scriptState = ScriptState::forMainWorld(loader->element()->document().frame());
ASSERT(m_scriptState);
}
+ m_requestURL = loader->imageSourceToKURL(loader->element()->imageSourceURL());
}
void run()
@@ -117,9 +118,9 @@ public:
InspectorInstrumentation::AsyncTask asyncTask(&context, this);
if (m_scriptState->contextIsValid()) {
ScriptState::Scope scope(m_scriptState.get());
- m_loader->doUpdateFromElement(m_shouldBypassMainWorldCSP, m_updateBehavior, m_referrerPolicy);
+ m_loader->doUpdateFromElement(m_shouldBypassMainWorldCSP, m_updateBehavior, m_requestURL, m_referrerPolicy);
} else {
- m_loader->doUpdateFromElement(m_shouldBypassMainWorldCSP, m_updateBehavior, m_referrerPolicy);
+ m_loader->doUpdateFromElement(m_shouldBypassMainWorldCSP, m_updateBehavior, m_requestURL, m_referrerPolicy);
}
}
@@ -141,6 +142,7 @@ private:
RefPtr<ScriptState> m_scriptState;
WeakPtrFactory<Task> m_weakFactory;
ReferrerPolicy m_referrerPolicy;
+ KURL m_requestURL;
};
ImageLoader::ImageLoader(Element* element)
@@ -251,7 +253,7 @@ inline void ImageLoader::enqueueImageLoadingMicroTask(UpdateFromElementBehavior
m_loadDelayCounter = IncrementLoadEventDelayCount::create(m_element->document());
}
-void ImageLoader::doUpdateFromElement(BypassMainWorldBehavior bypassBehavior, UpdateFromElementBehavior updateBehavior, ReferrerPolicy referrerPolicy)
+void ImageLoader::doUpdateFromElement(BypassMainWorldBehavior bypassBehavior, UpdateFromElementBehavior updateBehavior, const KURL& url, ReferrerPolicy referrerPolicy)
{
// FIXME: According to
// http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content.html#the-img-element:the-img-element-55
@@ -271,7 +273,6 @@ void ImageLoader::doUpdateFromElement(BypassMainWorldBehavior bypassBehavior, Up
return;
AtomicString imageSourceURL = m_element->imageSourceURL();
- KURL url = imageSourceToKURL(imageSourceURL);
ImageResource* newImage = nullptr;
if (!url.isNull()) {
// Unlike raw <img>, we block mixed content inside of <picture> or <img srcset>.
@@ -378,7 +379,7 @@ void ImageLoader::updateFromElement(UpdateFromElementBehavior updateBehavior, Re
KURL url = imageSourceToKURL(imageSourceURL);
if (shouldLoadImmediately(url)) {
- doUpdateFromElement(DoNotBypassMainWorldCSP, updateBehavior, referrerPolicy);
+ doUpdateFromElement(DoNotBypassMainWorldCSP, updateBehavior, url, referrerPolicy);
return;
}
// Allow the idiom "img.src=''; img.src='.." to clear down the image before
« no previous file with comments | « third_party/WebKit/Source/core/loader/ImageLoader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698