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

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

Issue 23437013: Consider "mixed content XHR" as mixed script instead of mixed display. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Tidy. Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/fetch/ResourceLoaderOptions.h ('k') | Source/core/xml/XMLHttpRequest.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 17 matching lines...) Expand all
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #include "config.h" 32 #include "config.h"
33 #include "core/loader/DocumentThreadableLoader.h" 33 #include "core/loader/DocumentThreadableLoader.h"
34 34
35 #include "core/dom/Document.h" 35 #include "core/dom/Document.h"
36 #include "core/fetch/FetchRequest.h" 36 #include "core/fetch/FetchRequest.h"
37 #include "core/fetch/RawResource.h" 37 #include "core/fetch/RawResource.h"
38 #include "core/fetch/Resource.h"
38 #include "core/fetch/ResourceFetcher.h" 39 #include "core/fetch/ResourceFetcher.h"
39 #include "core/inspector/InspectorInstrumentation.h" 40 #include "core/inspector/InspectorInstrumentation.h"
40 #include "core/loader/CrossOriginAccessControl.h" 41 #include "core/loader/CrossOriginAccessControl.h"
41 #include "core/loader/CrossOriginPreflightResultCache.h" 42 #include "core/loader/CrossOriginPreflightResultCache.h"
42 #include "core/loader/DocumentThreadableLoaderClient.h" 43 #include "core/loader/DocumentThreadableLoaderClient.h"
43 #include "core/loader/FrameLoader.h" 44 #include "core/loader/FrameLoader.h"
44 #include "core/loader/ThreadableLoaderClient.h" 45 #include "core/loader/ThreadableLoaderClient.h"
45 #include "core/page/ContentSecurityPolicy.h" 46 #include "core/page/ContentSecurityPolicy.h"
46 #include "core/page/Frame.h" 47 #include "core/page/Frame.h"
47 #include "core/platform/network/ResourceError.h" 48 #include "core/platform/network/ResourceError.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 } 406 }
406 407
407 void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, Secur ityCheckPolicy securityCheck) 408 void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, Secur ityCheckPolicy securityCheck)
408 { 409 {
409 // Any credential should have been removed from the cross-site requests. 410 // Any credential should have been removed from the cross-site requests.
410 const KURL& requestURL = request.url(); 411 const KURL& requestURL = request.url();
411 m_options.securityCheck = securityCheck; 412 m_options.securityCheck = securityCheck;
412 ASSERT(m_sameOriginRequest || requestURL.user().isEmpty()); 413 ASSERT(m_sameOriginRequest || requestURL.user().isEmpty());
413 ASSERT(m_sameOriginRequest || requestURL.pass().isEmpty()); 414 ASSERT(m_sameOriginRequest || requestURL.pass().isEmpty());
414 415
416 ThreadableLoaderOptions options = m_options;
415 if (m_async) { 417 if (m_async) {
416 ThreadableLoaderOptions options = m_options;
417 options.crossOriginCredentialPolicy = DoNotAskClientForCrossOriginCreden tials; 418 options.crossOriginCredentialPolicy = DoNotAskClientForCrossOriginCreden tials;
418 if (m_actualRequest) { 419 if (m_actualRequest) {
419 // Don't sniff content or send load callbacks for the preflight requ est. 420 // Don't sniff content or send load callbacks for the preflight requ est.
420 options.sendLoadCallbacks = DoNotSendCallbacks; 421 options.sendLoadCallbacks = DoNotSendCallbacks;
421 options.sniffContent = DoNotSniffContent; 422 options.sniffContent = DoNotSniffContent;
422 // Keep buffering the data for the preflight request. 423 // Keep buffering the data for the preflight request.
423 options.dataBufferingPolicy = BufferData; 424 options.dataBufferingPolicy = BufferData;
424 } 425 }
425 426
426 if (m_options.timeoutMilliseconds > 0) 427 if (m_options.timeoutMilliseconds > 0)
(...skipping 11 matching lines...) Expand all
438 } 439 }
439 return; 440 return;
440 } 441 }
441 442
442 // FIXME: ThreadableLoaderOptions.sniffContent is not supported for synchron ous requests. 443 // FIXME: ThreadableLoaderOptions.sniffContent is not supported for synchron ous requests.
443 Vector<char> data; 444 Vector<char> data;
444 ResourceError error; 445 ResourceError error;
445 ResourceResponse response; 446 ResourceResponse response;
446 unsigned long identifier = std::numeric_limits<unsigned long>::max(); 447 unsigned long identifier = std::numeric_limits<unsigned long>::max();
447 if (Frame* frame = m_document->frame()) { 448 if (Frame* frame = m_document->frame()) {
448 Frame* top = frame->tree()->top(); 449 if (!m_document->fetcher()->checkInsecureContent(Resource::Raw, requestU RL, options.mixedContentBlockingTreatment)) {
449 if (!top->loader()->mixedContentChecker()->canDisplayInsecureContent(top ->document()->securityOrigin(), requestURL)) {
450 m_client->didFail(error); 450 m_client->didFail(error);
451 return; 451 return;
452 } 452 }
453 identifier = frame->loader()->loadResourceSynchronously(request, m_optio ns.allowCredentials, error, response, data); 453 identifier = frame->loader()->loadResourceSynchronously(request, m_optio ns.allowCredentials, error, response, data);
454 } 454 }
455 455
456 InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(m_ document, identifier, m_client); 456 InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient(m_ document, identifier, m_client);
457 457
458 // No exception for file:/// resources, see <rdar://problem/4962298>. 458 // No exception for file:/// resources, see <rdar://problem/4962298>.
459 // Also, if we have an HTTP response, then it wasn't a network error in fact . 459 // Also, if we have an HTTP response, then it wasn't a network error in fact .
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 508
509 if (!(requestUrl.user().isEmpty() && requestUrl.pass().isEmpty())) { 509 if (!(requestUrl.user().isEmpty() && requestUrl.pass().isEmpty())) {
510 errorDescription = "The request was redirected to a URL ('" + requestUrl .string() + "') containing userinfo, which is disallowed for cross-origin reques ts."; 510 errorDescription = "The request was redirected to a URL ('" + requestUrl .string() + "') containing userinfo, which is disallowed for cross-origin reques ts.";
511 return false; 511 return false;
512 } 512 }
513 513
514 return true; 514 return true;
515 } 515 }
516 516
517 } // namespace WebCore 517 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/fetch/ResourceLoaderOptions.h ('k') | Source/core/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698