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

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

Issue 356243003: Block mixed <picture> and <img srcset> by default. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Tests. 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 5173f9a94d191e1d76cd595ec511127305f34104..c336ec8c298885c2204f124d3912fb19e05859fb 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;
+ 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