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

Side by Side Diff: third_party/WebKit/Source/core/loader/LinkLoader.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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 dnsPrefetchIfNeeded(relAttribute, url, *document, networkHintsInterf ace, LinkCalledFromHeader); 225 dnsPrefetchIfNeeded(relAttribute, url, *document, networkHintsInterf ace, LinkCalledFromHeader);
226 226
227 if (RuntimeEnabledFeatures::linkPreconnectEnabled()) 227 if (RuntimeEnabledFeatures::linkPreconnectEnabled())
228 preconnectIfNeeded(relAttribute, url, *document, header.crossOrigin( ), networkHintsInterface, LinkCalledFromHeader); 228 preconnectIfNeeded(relAttribute, url, *document, header.crossOrigin( ), networkHintsInterface, LinkCalledFromHeader);
229 229
230 // FIXME: Add more supported headers as needed. 230 // FIXME: Add more supported headers as needed.
231 } 231 }
232 return true; 232 return true;
233 } 233 }
234 234
235 bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, const AtomicStri ng& crossOriginMode, const String& type, const String& as, const KURL& href, Doc ument& document, const NetworkHintsInterface& networkHintsInterface) 235 bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, CrossOriginAttri buteValue crossOrigin, const String& type, const String& as, const KURL& href, D ocument& document, const NetworkHintsInterface& networkHintsInterface)
236 { 236 {
237 // TODO(yoav): Do all links need to load only after they're in document??? 237 // TODO(yoav): Do all links need to load only after they're in document???
238 238
239 // TODO(yoav): Convert all uses of the CrossOriginAttribute to CrossOriginAt tributeValue. crbug.com/486689 239 // TODO(yoav): Convert all uses of the CrossOriginAttribute to CrossOriginAt tributeValue. crbug.com/486689
240 // FIXME(crbug.com/463266): We're ignoring type here. Maybe we shouldn't. 240 // FIXME(crbug.com/463266): We're ignoring type here. Maybe we shouldn't.
241 dnsPrefetchIfNeeded(relAttribute, href, document, networkHintsInterface, Lin kCalledFromMarkup); 241 dnsPrefetchIfNeeded(relAttribute, href, document, networkHintsInterface, Lin kCalledFromMarkup);
242 242
243 preconnectIfNeeded(relAttribute, href, document, crossOriginAttributeValue(c rossOriginMode), networkHintsInterface, LinkCalledFromMarkup); 243 preconnectIfNeeded(relAttribute, href, document, crossOrigin, networkHintsIn terface, LinkCalledFromMarkup);
244 244
245 if (m_client->shouldLoadLink()) 245 if (m_client->shouldLoadLink())
246 preloadIfNeeded(relAttribute, href, document, as); 246 preloadIfNeeded(relAttribute, href, document, as);
247 247
248 // FIXME(crbug.com/323096): Should take care of import. 248 // FIXME(crbug.com/323096): Should take care of import.
249 if ((relAttribute.isLinkPrefetch() || relAttribute.isLinkSubresource()) && h ref.isValid() && document.frame()) { 249 if ((relAttribute.isLinkPrefetch() || relAttribute.isLinkSubresource()) && h ref.isValid() && document.frame()) {
250 if (!m_client->shouldLoadLink()) 250 if (!m_client->shouldLoadLink())
251 return false; 251 return false;
252 Resource::Type type = Resource::LinkPrefetch; 252 Resource::Type type = Resource::LinkPrefetch;
253 if (relAttribute.isLinkSubresource()) { 253 if (relAttribute.isLinkSubresource()) {
254 type = Resource::LinkSubresource; 254 type = Resource::LinkSubresource;
255 UseCounter::count(document, UseCounter::LinkRelSubresource); 255 UseCounter::count(document, UseCounter::LinkRelSubresource);
256 } else { 256 } else {
257 UseCounter::count(document, UseCounter::LinkRelPrefetch); 257 UseCounter::count(document, UseCounter::LinkRelPrefetch);
258 } 258 }
259 259
260 FetchRequest linkRequest(ResourceRequest(document.completeURL(href)), Fe tchInitiatorTypeNames::link); 260 FetchRequest linkRequest(ResourceRequest(document.completeURL(href)), Fe tchInitiatorTypeNames::link);
261 if (!crossOriginMode.isNull()) 261 if (crossOrigin != CrossOriginAttributeNotSet)
262 linkRequest.setCrossOriginAccessControl(document.securityOrigin(), c rossOriginMode); 262 linkRequest.setCrossOriginAccessControl(document.securityOrigin(), c rossOrigin);
263 setResource(LinkFetchResource::fetch(type, linkRequest, document.fetcher ())); 263 setResource(LinkFetchResource::fetch(type, linkRequest, document.fetcher ()));
264 } 264 }
265 265
266 if (const unsigned prerenderRelTypes = prerenderRelTypesFromRelAttribute(rel Attribute, document)) { 266 if (const unsigned prerenderRelTypes = prerenderRelTypesFromRelAttribute(rel Attribute, document)) {
267 if (!m_prerender) { 267 if (!m_prerender) {
268 m_prerender = PrerenderHandle::create(document, this, href, prerende rRelTypes); 268 m_prerender = PrerenderHandle::create(document, this, href, prerende rRelTypes);
269 } else if (m_prerender->url() != href) { 269 } else if (m_prerender->url() != href) {
270 m_prerender->cancel(); 270 m_prerender->cancel();
271 m_prerender = PrerenderHandle::create(document, this, href, prerende rRelTypes); 271 m_prerender = PrerenderHandle::create(document, this, href, prerende rRelTypes);
272 } 272 }
(...skipping 14 matching lines...) Expand all
287 m_prerender.clear(); 287 m_prerender.clear();
288 } 288 }
289 } 289 }
290 290
291 DEFINE_TRACE(LinkLoader) 291 DEFINE_TRACE(LinkLoader)
292 { 292 {
293 visitor->trace(m_prerender); 293 visitor->trace(m_prerender);
294 } 294 }
295 295
296 } 296 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/LinkLoader.h ('k') | third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698