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

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
« no previous file with comments | « Source/core/fetch/ResourceFetcher.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('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) 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 if (m_async) { 419 if (m_async) {
420 if (m_actualRequest) { 420 if (m_actualRequest) {
421 resourceLoaderOptions.sniffContent = DoNotSniffContent; 421 resourceLoaderOptions.sniffContent = DoNotSniffContent;
422 resourceLoaderOptions.dataBufferingPolicy = BufferData; 422 resourceLoaderOptions.dataBufferingPolicy = BufferData;
423 } 423 }
424 424
425 if (m_options.timeoutMilliseconds > 0) 425 if (m_options.timeoutMilliseconds > 0)
426 m_timeoutTimer.startOneShot(m_options.timeoutMilliseconds / 1000.0, FROM_HERE); 426 m_timeoutTimer.startOneShot(m_options.timeoutMilliseconds / 1000.0, FROM_HERE);
427 427
428 FetchRequest newRequest(request, m_options.initiator, resourceLoaderOpti ons); 428 FetchRequest newRequest(request, m_options.initiator, resourceLoaderOpti ons);
429 if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests)
430 newRequest.setOriginRestriction(FetchRequest::NoOriginRestriction);
429 ASSERT(!resource()); 431 ASSERT(!resource());
430 if (request.requestContext() == blink::WebURLRequest::RequestContextVide o || request.requestContext() == blink::WebURLRequest::RequestContextAudio) 432 if (request.requestContext() == blink::WebURLRequest::RequestContextVide o || request.requestContext() == blink::WebURLRequest::RequestContextAudio)
431 setResource(m_document.fetcher()->fetchMedia(newRequest)); 433 setResource(m_document.fetcher()->fetchMedia(newRequest));
432 else 434 else
433 setResource(m_document.fetcher()->fetchRawResource(newRequest)); 435 setResource(m_document.fetcher()->fetchRawResource(newRequest));
434 if (resource() && resource()->loader()) { 436 if (resource() && resource()->loader()) {
435 unsigned long identifier = resource()->identifier(); 437 unsigned long identifier = resource()->identifier();
436 InspectorInstrumentation::documentThreadableLoaderStartedLoadingForC lient(&m_document, identifier, m_client); 438 InspectorInstrumentation::documentThreadableLoaderStartedLoadingForC lient(&m_document, identifier, m_client);
437 } 439 }
438 return; 440 return;
439 } 441 }
440 442
441 FetchRequest fetchRequest(request, m_options.initiator, resourceLoaderOption s); 443 FetchRequest fetchRequest(request, m_options.initiator, resourceLoaderOption s);
444 if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests)
445 fetchRequest.setOriginRestriction(FetchRequest::NoOriginRestriction);
442 ResourcePtr<Resource> resource = m_document.fetcher()->fetchSynchronously(fe tchRequest); 446 ResourcePtr<Resource> resource = m_document.fetcher()->fetchSynchronously(fe tchRequest);
443 ResourceResponse response = resource ? resource->response() : ResourceRespon se(); 447 ResourceResponse response = resource ? resource->response() : ResourceRespon se();
444 unsigned long identifier = resource ? resource->identifier() : std::numeric_ limits<unsigned long>::max(); 448 unsigned long identifier = resource ? resource->identifier() : std::numeric_ limits<unsigned long>::max();
445 ResourceError error = resource ? resource->resourceError() : ResourceError() ; 449 ResourceError error = resource ? resource->resourceError() : ResourceError() ;
446 450
447 InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(&m _document, identifier, m_client); 451 InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(&m _document, identifier, m_client);
448 452
449 if (!resource) { 453 if (!resource) {
450 m_client->didFail(error); 454 m_client->didFail(error);
451 return; 455 return;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 return DoNotAllowStoredCredentials; 500 return DoNotAllowStoredCredentials;
497 return m_resourceLoaderOptions.allowCredentials; 501 return m_resourceLoaderOptions.allowCredentials;
498 } 502 }
499 503
500 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const 504 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const
501 { 505 {
502 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin (); 506 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin ();
503 } 507 }
504 508
505 } // namespace WebCore 509 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/fetch/ResourceFetcher.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698