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

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

Issue 344883006: Give the RequestFetcher access to cross-origin URLs when allowed (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013, Intel Corporation 3 * Copyright (C) 2013, Intel Corporation
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 if (m_async) { 417 if (m_async) {
418 if (m_actualRequest) { 418 if (m_actualRequest) {
419 resourceLoaderOptions.sniffContent = DoNotSniffContent; 419 resourceLoaderOptions.sniffContent = DoNotSniffContent;
420 resourceLoaderOptions.dataBufferingPolicy = BufferData; 420 resourceLoaderOptions.dataBufferingPolicy = BufferData;
421 } 421 }
422 422
423 if (m_options.timeoutMilliseconds > 0) 423 if (m_options.timeoutMilliseconds > 0)
424 m_timeoutTimer.startOneShot(m_options.timeoutMilliseconds / 1000.0, FROM_HERE); 424 m_timeoutTimer.startOneShot(m_options.timeoutMilliseconds / 1000.0, FROM_HERE);
425 425
426 FetchRequest newRequest(request, m_options.initiator, resourceLoaderOpti ons); 426 FetchRequest newRequest(request, m_options.initiator, resourceLoaderOpti ons);
427 if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests)
428 newRequest.setOriginRestriction(FetchRequest::NoOriginRestriction);
427 ASSERT(!resource()); 429 ASSERT(!resource());
428 if (request.requestContext() == blink::WebURLRequest::RequestContextVide o || request.requestContext() == blink::WebURLRequest::RequestContextAudio) 430 if (request.requestContext() == blink::WebURLRequest::RequestContextVide o || request.requestContext() == blink::WebURLRequest::RequestContextAudio)
429 setResource(m_document.fetcher()->fetchMedia(newRequest)); 431 setResource(m_document.fetcher()->fetchMedia(newRequest));
430 else 432 else
431 setResource(m_document.fetcher()->fetchRawResource(newRequest)); 433 setResource(m_document.fetcher()->fetchRawResource(newRequest));
432 if (resource() && resource()->loader()) { 434 if (resource() && resource()->loader()) {
433 unsigned long identifier = resource()->identifier(); 435 unsigned long identifier = resource()->identifier();
434 InspectorInstrumentation::documentThreadableLoaderStartedLoadingForC lient(&m_document, identifier, m_client); 436 InspectorInstrumentation::documentThreadableLoaderStartedLoadingForC lient(&m_document, identifier, m_client);
435 } 437 }
436 return; 438 return;
437 } 439 }
438 440
439 FetchRequest fetchRequest(request, m_options.initiator, resourceLoaderOption s); 441 FetchRequest fetchRequest(request, m_options.initiator, resourceLoaderOption s);
442 if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests)
443 fetchRequest.setOriginRestriction(FetchRequest::NoOriginRestriction);
440 ResourcePtr<Resource> resource = m_document.fetcher()->fetchSynchronously(fe tchRequest); 444 ResourcePtr<Resource> resource = m_document.fetcher()->fetchSynchronously(fe tchRequest);
441 ResourceResponse response = resource ? resource->response() : ResourceRespon se(); 445 ResourceResponse response = resource ? resource->response() : ResourceRespon se();
442 unsigned long identifier = resource ? resource->identifier() : std::numeric_ limits<unsigned long>::max(); 446 unsigned long identifier = resource ? resource->identifier() : std::numeric_ limits<unsigned long>::max();
443 ResourceError error = resource ? resource->resourceError() : ResourceError() ; 447 ResourceError error = resource ? resource->resourceError() : ResourceError() ;
444 448
445 InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(&m _document, identifier, m_client); 449 InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(&m _document, identifier, m_client);
446 450
447 if (!resource) { 451 if (!resource) {
448 m_client->didFail(error); 452 m_client->didFail(error);
449 return; 453 return;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 return DoNotAllowStoredCredentials; 498 return DoNotAllowStoredCredentials;
495 return m_resourceLoaderOptions.allowCredentials; 499 return m_resourceLoaderOptions.allowCredentials;
496 } 500 }
497 501
498 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const 502 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const
499 { 503 {
500 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin (); 504 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin ();
501 } 505 }
502 506
503 } // namespace WebCore 507 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698