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

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

Issue 368203002: Block mixed <picture> and <img srcset> by default. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | « LayoutTests/http/tests/security/mixedContent/resources/frame-with-insecure-srcset.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/ImageLoader.cpp
diff --git a/Source/core/loader/ImageLoader.cpp b/Source/core/loader/ImageLoader.cpp
index 82f635a5d9da63656a0d33a042f3846bfd4774bd..5f561b7b105ce871113b55b8ef7bf8098f68195e 100644
--- a/Source/core/loader/ImageLoader.cpp
+++ b/Source/core/loader/ImageLoader.cpp
@@ -183,7 +183,11 @@ void ImageLoader::doUpdateFromElement(bool bypassMainWorldCSP)
KURL url = imageURL();
ResourcePtr<ImageResource> newImage = 0;
if (!url.isNull()) {
- FetchRequest request(ResourceRequest(url), element()->localName());
+ // Unlike raw <img>, we block mixed content inside of <picture> or <img srcset>.
+ ResourceLoaderOptions resourceLoaderOptions = ResourceFetcher::defaultResourceOptions();
+ if (isHTMLPictureElement(element()->parentNode()) || !element()->fastGetAttribute(HTMLNames::srcsetAttr).isEmpty())
+ resourceLoaderOptions.mixedContentBlockingTreatment = TreatAsActiveContent;
+ FetchRequest request(ResourceRequest(url), element()->localName(), resourceLoaderOptions);
if (bypassMainWorldCSP)
request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy);
« no previous file with comments | « LayoutTests/http/tests/security/mixedContent/resources/frame-with-insecure-srcset.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698