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

Side by Side Diff: third_party/WebKit/Source/core/loader/ImageLoader.cpp

Issue 1487343002: Set credentials mode "same-origin" when crossOrigin=anonymous is set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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
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 20 matching lines...) Expand all
31 #include "core/dom/IncrementLoadEventDelayCount.h" 31 #include "core/dom/IncrementLoadEventDelayCount.h"
32 #include "core/dom/Microtask.h" 32 #include "core/dom/Microtask.h"
33 #include "core/events/Event.h" 33 #include "core/events/Event.h"
34 #include "core/events/EventSender.h" 34 #include "core/events/EventSender.h"
35 #include "core/fetch/FetchRequest.h" 35 #include "core/fetch/FetchRequest.h"
36 #include "core/fetch/MemoryCache.h" 36 #include "core/fetch/MemoryCache.h"
37 #include "core/fetch/ResourceFetcher.h" 37 #include "core/fetch/ResourceFetcher.h"
38 #include "core/frame/LocalFrame.h" 38 #include "core/frame/LocalFrame.h"
39 #include "core/frame/Settings.h" 39 #include "core/frame/Settings.h"
40 #include "core/frame/UseCounter.h" 40 #include "core/frame/UseCounter.h"
41 #include "core/html/CrossOriginAttribute.h"
41 #include "core/html/HTMLImageElement.h" 42 #include "core/html/HTMLImageElement.h"
42 #include "core/html/parser/HTMLParserIdioms.h" 43 #include "core/html/parser/HTMLParserIdioms.h"
43 #include "core/layout/LayoutImage.h" 44 #include "core/layout/LayoutImage.h"
44 #include "core/layout/LayoutVideo.h" 45 #include "core/layout/LayoutVideo.h"
45 #include "core/layout/svg/LayoutSVGImage.h" 46 #include "core/layout/svg/LayoutSVGImage.h"
46 #include "core/svg/graphics/SVGImage.h" 47 #include "core/svg/graphics/SVGImage.h"
47 #include "platform/Logging.h" 48 #include "platform/Logging.h"
48 #include "platform/RuntimeEnabledFeatures.h" 49 #include "platform/RuntimeEnabledFeatures.h"
49 #include "platform/weborigin/SecurityOrigin.h" 50 #include "platform/weborigin/SecurityOrigin.h"
50 #include "platform/weborigin/SecurityPolicy.h" 51 #include "platform/weborigin/SecurityPolicy.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 247
247 if (LayoutImageResource* imageResource = layoutImageResource()) 248 if (LayoutImageResource* imageResource = layoutImageResource())
248 imageResource->resetAnimation(); 249 imageResource->resetAnimation();
249 } 250 }
250 251
251 static void configureRequest(FetchRequest& request, ImageLoader::BypassMainWorld Behavior bypassBehavior, Element& element, const ClientHintsPreferences& clientH intsPreferences) 252 static void configureRequest(FetchRequest& request, ImageLoader::BypassMainWorld Behavior bypassBehavior, Element& element, const ClientHintsPreferences& clientH intsPreferences)
252 { 253 {
253 if (bypassBehavior == ImageLoader::BypassMainWorldCSP) 254 if (bypassBehavior == ImageLoader::BypassMainWorldCSP)
254 request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy); 255 request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy);
255 256
256 AtomicString crossOriginMode = element.fastGetAttribute(HTMLNames::crossorig inAttr); 257 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue(element.fa stGetAttribute(HTMLNames::crossoriginAttr));
257 if (!crossOriginMode.isNull()) 258 if (crossOrigin != CrossOriginAttributeNotSet)
258 request.setCrossOriginAccessControl(element.document().securityOrigin(), crossOriginMode); 259 request.setCrossOriginAccessControl(element.document().securityOrigin(), crossOrigin);
259 260
260 if (clientHintsPreferences.shouldSendResourceWidth() && isHTMLImageElement(e lement)) 261 if (clientHintsPreferences.shouldSendResourceWidth() && isHTMLImageElement(e lement))
261 request.setResourceWidth(toHTMLImageElement(element).resourceWidth()); 262 request.setResourceWidth(toHTMLImageElement(element).resourceWidth());
262 } 263 }
263 264
264 inline void ImageLoader::dispatchErrorEvent() 265 inline void ImageLoader::dispatchErrorEvent()
265 { 266 {
266 m_hasPendingErrorEvent = true; 267 m_hasPendingErrorEvent = true;
267 errorEventSender().dispatchEventSoon(this); 268 errorEventSender().dispatchEventSoon(this);
268 } 269 }
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 677
677 void ImageLoader::sourceImageChanged() 678 void ImageLoader::sourceImageChanged()
678 { 679 {
679 for (auto& client : m_clients) { 680 for (auto& client : m_clients) {
680 ImageLoaderClient* handle = client; 681 ImageLoaderClient* handle = client;
681 handle->notifyImageSourceChanged(); 682 handle->notifyImageSourceChanged();
682 } 683 }
683 } 684 }
684 685
685 } // namespace blink 686 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp ('k') | third_party/WebKit/Source/core/loader/LinkLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698