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

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

Issue 135723008: Add CORS support for <link> elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add setCrossOriginAccessControl() helper to avoid repetition matching CORS attribute value Created 6 years, 10 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
« no previous file with comments | « Source/core/html/parser/HTMLPreloadScanner.cpp ('k') | Source/core/loader/LinkLoader.h » ('j') | 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 if (!m_failedLoadURL.isEmpty() && attr == m_failedLoadURL) 151 if (!m_failedLoadURL.isEmpty() && attr == m_failedLoadURL)
152 return; 152 return;
153 153
154 // Do not load any image if the 'src' attribute is missing or if it is 154 // Do not load any image if the 'src' attribute is missing or if it is
155 // an empty string. 155 // an empty string.
156 ResourcePtr<ImageResource> newImage = 0; 156 ResourcePtr<ImageResource> newImage = 0;
157 if (!attr.isNull() && !stripLeadingAndTrailingHTMLSpaces(attr).isEmpty()) { 157 if (!attr.isNull() && !stripLeadingAndTrailingHTMLSpaces(attr).isEmpty()) {
158 FetchRequest request(ResourceRequest(document.completeURL(sourceURI(attr ))), element()->localName()); 158 FetchRequest request(ResourceRequest(document.completeURL(sourceURI(attr ))), element()->localName());
159 159
160 AtomicString crossOriginMode = m_element->fastGetAttribute(HTMLNames::cr ossoriginAttr); 160 AtomicString crossOriginMode = m_element->fastGetAttribute(HTMLNames::cr ossoriginAttr);
161 if (!crossOriginMode.isNull()) { 161 if (!crossOriginMode.isNull())
162 StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMo de, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; 162 request.setCrossOriginAccessControl(document.securityOrigin(), cross OriginMode);
163 request.setCrossOriginAccessControl(document.securityOrigin(), allow Credentials);
164 }
165 163
166 if (m_loadManually) { 164 if (m_loadManually) {
167 bool autoLoadOtherImages = document.fetcher()->autoLoadImages(); 165 bool autoLoadOtherImages = document.fetcher()->autoLoadImages();
168 document.fetcher()->setAutoLoadImages(false); 166 document.fetcher()->setAutoLoadImages(false);
169 newImage = new ImageResource(request.resourceRequest()); 167 newImage = new ImageResource(request.resourceRequest());
170 newImage->setLoading(true); 168 newImage->setLoading(true);
171 document.fetcher()->m_documentResources.set(newImage->url(), newImag e.get()); 169 document.fetcher()->m_documentResources.set(newImage->url(), newImag e.get());
172 document.fetcher()->setAutoLoadImages(autoLoadOtherImages); 170 document.fetcher()->setAutoLoadImages(autoLoadOtherImages);
173 } else { 171 } else {
174 newImage = document.fetcher()->fetchImage(request); 172 newImage = document.fetcher()->fetchImage(request);
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 handle->notifyImageSourceChanged(); 464 handle->notifyImageSourceChanged();
467 } 465 }
468 } 466 }
469 467
470 inline void ImageLoader::clearFailedLoadURL() 468 inline void ImageLoader::clearFailedLoadURL()
471 { 469 {
472 m_failedLoadURL = AtomicString(); 470 m_failedLoadURL = AtomicString();
473 } 471 }
474 472
475 } 473 }
OLDNEW
« no previous file with comments | « Source/core/html/parser/HTMLPreloadScanner.cpp ('k') | Source/core/loader/LinkLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698