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

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

Issue 54173002: Allow accessing data URL resource using CORS (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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 | « LayoutTests/fast/xmlhttprequest/xmlhttprequest-data-url-expected.txt ('k') | no next file » | 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoa der(document, client, LoadAsynchronously, request, options)); 66 RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoa der(document, client, LoadAsynchronously, request, options));
67 if (!loader->m_resource) 67 if (!loader->m_resource)
68 loader = 0; 68 loader = 0;
69 return loader.release(); 69 return loader.release();
70 } 70 }
71 71
72 DocumentThreadableLoader::DocumentThreadableLoader(Document* document, Threadabl eLoaderClient* client, BlockingBehavior blockingBehavior, const ResourceRequest& request, const ThreadableLoaderOptions& options) 72 DocumentThreadableLoader::DocumentThreadableLoader(Document* document, Threadabl eLoaderClient* client, BlockingBehavior blockingBehavior, const ResourceRequest& request, const ThreadableLoaderOptions& options)
73 : m_client(client) 73 : m_client(client)
74 , m_document(document) 74 , m_document(document)
75 , m_options(options) 75 , m_options(options)
76 , m_sameOriginRequest(securityOrigin()->canRequest(request.url())) 76 , m_sameOriginRequest(securityOrigin()->canRequest(request.url()) || request .url().protocolIsData())
77 , m_simpleRequest(true) 77 , m_simpleRequest(true)
78 , m_async(blockingBehavior == LoadAsynchronously) 78 , m_async(blockingBehavior == LoadAsynchronously)
79 , m_timeoutTimer(this, &DocumentThreadableLoader::didTimeout) 79 , m_timeoutTimer(this, &DocumentThreadableLoader::didTimeout)
80 { 80 {
81 ASSERT(document); 81 ASSERT(document);
82 ASSERT(client); 82 ASSERT(client);
83 // Setting an outgoing referer is only supported in the async code path. 83 // Setting an outgoing referer is only supported in the async code path.
84 ASSERT(m_async || request.httpReferrer().isEmpty()); 84 ASSERT(m_async || request.httpReferrer().isEmpty());
85 85
86 if (m_sameOriginRequest || m_options.crossOriginRequestPolicy == AllowCrossO riginRequests) { 86 if (m_sameOriginRequest || m_options.crossOriginRequestPolicy == AllowCrossO riginRequests) {
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 507
508 if (!(requestUrl.user().isEmpty() && requestUrl.pass().isEmpty())) { 508 if (!(requestUrl.user().isEmpty() && requestUrl.pass().isEmpty())) {
509 errorDescription = "The request was redirected to a URL ('" + requestUrl .string() + "') containing userinfo, which is disallowed for cross-origin reques ts."; 509 errorDescription = "The request was redirected to a URL ('" + requestUrl .string() + "') containing userinfo, which is disallowed for cross-origin reques ts.";
510 return false; 510 return false;
511 } 511 }
512 512
513 return true; 513 return true;
514 } 514 }
515 515
516 } // namespace WebCore 516 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/xmlhttprequest/xmlhttprequest-data-url-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698