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

Unified Diff: Source/core/html/HTMLLinkElement.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, 11 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 | « Source/core/html/HTMLLinkElement.h ('k') | Source/core/html/HTMLLinkElement.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLLinkElement.cpp
diff --git a/Source/core/html/HTMLLinkElement.cpp b/Source/core/html/HTMLLinkElement.cpp
index cc886008ace6cc162c2b06b48339ae03b32eacf9..52fd4033cc62dcb8451266986bbe8b524941d666 100644
--- a/Source/core/html/HTMLLinkElement.cpp
+++ b/Source/core/html/HTMLLinkElement.cpp
@@ -138,6 +138,11 @@ bool HTMLLinkElement::shouldLoadLink()
return continueLoad;
}
+bool HTMLLinkElement::loadLink(const String& type, const KURL& url)
+{
+ return m_linkLoader.loadLink(m_relAttribute, fastGetAttribute(HTMLNames::crossoriginAttr), type, url, document());
+}
+
LinkResource* HTMLLinkElement::linkResourceToProcess()
{
bool visible = inDocument() && !m_isInShadowTree;
@@ -590,6 +595,11 @@ void LinkStyle::process()
// Load stylesheets that are not needed for the rendering immediately with low priority.
FetchRequest request = builder.build(blocking);
+ AtomicString crossOriginMode = m_owner->fastGetAttribute(HTMLNames::crossoriginAttr);
+ if (!crossOriginMode.isNull()) {
+ StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
+ request.setCrossOriginAccessControl(document().securityOrigin(), allowCredentials);
+ }
setResource(document().fetcher()->fetchCSSStyleSheet(request));
if (!resource()) {
« no previous file with comments | « Source/core/html/HTMLLinkElement.h ('k') | Source/core/html/HTMLLinkElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698