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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv ed.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 Document& document = m_element->document(); 177 Document& document = m_element->document();
178 if (!document.isActive()) 178 if (!document.isActive())
179 return; 179 return;
180 180
181 AtomicString attr = m_element->imageSourceURL(); 181 AtomicString attr = m_element->imageSourceURL();
182 182
183 KURL url = imageURL(); 183 KURL url = imageURL();
184 ResourcePtr<ImageResource> newImage = 0; 184 ResourcePtr<ImageResource> newImage = 0;
185 if (!url.isNull()) { 185 if (!url.isNull()) {
186 FetchRequest request(ResourceRequest(url), element()->localName()); 186 // Unlike raw <img>, we block mixed content inside of <picture> or <img srcset>.
187 ResourceLoaderOptions resourceLoaderOptions = ResourceFetcher::defaultRe sourceOptions();
188 if (isHTMLPictureElement(element()->parentNode()) || !element()->fastGet Attribute(HTMLNames::srcsetAttr).isEmpty())
189 resourceLoaderOptions.mixedContentBlockingTreatment = TreatAsActiveC ontent;
190 FetchRequest request(ResourceRequest(url), element()->localName(), resou rceLoaderOptions);
187 if (bypassMainWorldCSP) 191 if (bypassMainWorldCSP)
188 request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy); 192 request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy);
189 193
190 AtomicString crossOriginMode = m_element->fastGetAttribute(HTMLNames::cr ossoriginAttr); 194 AtomicString crossOriginMode = m_element->fastGetAttribute(HTMLNames::cr ossoriginAttr);
191 if (!crossOriginMode.isNull()) 195 if (!crossOriginMode.isNull())
192 request.setCrossOriginAccessControl(document.securityOrigin(), cross OriginMode); 196 request.setCrossOriginAccessControl(document.securityOrigin(), cross OriginMode);
193 197
194 if (m_loadManually) { 198 if (m_loadManually) {
195 bool autoLoadOtherImages = document.fetcher()->autoLoadImages(); 199 bool autoLoadOtherImages = document.fetcher()->autoLoadImages();
196 document.fetcher()->setAutoLoadImages(false); 200 document.fetcher()->setAutoLoadImages(false);
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 } 543 }
540 544
541 #if ENABLE(OILPAN) 545 #if ENABLE(OILPAN)
542 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover() 546 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover()
543 { 547 {
544 m_loader.willRemoveClient(m_client); 548 m_loader.willRemoveClient(m_client);
545 } 549 }
546 #endif 550 #endif
547 551
548 } 552 }
OLDNEW
« 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