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

Side by Side Diff: Source/core/xml/XMLHttpRequest.cpp

Issue 16199002: DevTools: Support asynchronous loading of resources without cross origin checks through backend for… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ... Created 7 years, 6 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/xml/XMLHttpRequest.h ('k') | Source/devtools/protocol.json » ('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) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org>
4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org>
5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved.
6 * Copyright (C) 2012 Intel Corporation 6 * Copyright (C) 2012 Intel Corporation
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 , m_includeCredentials(false) 173 , m_includeCredentials(false)
174 #if ENABLE(XHR_TIMEOUT) 174 #if ENABLE(XHR_TIMEOUT)
175 , m_timeoutMilliseconds(0) 175 , m_timeoutMilliseconds(0)
176 #endif 176 #endif
177 , m_state(UNSENT) 177 , m_state(UNSENT)
178 , m_createdDocument(false) 178 , m_createdDocument(false)
179 , m_error(false) 179 , m_error(false)
180 , m_uploadEventsAllowed(true) 180 , m_uploadEventsAllowed(true)
181 , m_uploadComplete(false) 181 , m_uploadComplete(false)
182 , m_sameOriginRequest(true) 182 , m_sameOriginRequest(true)
183 , m_allowCrossOriginRequests(false)
183 , m_receivedLength(0) 184 , m_receivedLength(0)
184 , m_lastSendLineNumber(0) 185 , m_lastSendLineNumber(0)
185 , m_exceptionCode(0) 186 , m_exceptionCode(0)
186 , m_progressEventThrottle(this) 187 , m_progressEventThrottle(this)
187 , m_responseTypeCode(ResponseTypeDefault) 188 , m_responseTypeCode(ResponseTypeDefault)
188 , m_securityOrigin(securityOrigin) 189 , m_securityOrigin(securityOrigin)
189 { 190 {
190 initializeXMLHttpRequestStaticData(); 191 initializeXMLHttpRequestStaticData();
191 #ifndef NDEBUG 192 #ifndef NDEBUG
192 xmlHttpRequestCounter.increment(); 193 xmlHttpRequestCounter.increment();
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 683
683 if (m_method != "GET" && m_method != "HEAD" && m_url.protocolIsInHTTPFamily( )) { 684 if (m_method != "GET" && m_method != "HEAD" && m_url.protocolIsInHTTPFamily( )) {
684 m_requestEntityBody = FormData::create(data, length); 685 m_requestEntityBody = FormData::create(data, length);
685 if (m_upload) 686 if (m_upload)
686 m_requestEntityBody->setAlwaysStream(true); 687 m_requestEntityBody->setAlwaysStream(true);
687 } 688 }
688 689
689 createRequest(ec); 690 createRequest(ec);
690 } 691 }
691 692
692 void XMLHttpRequest::sendFromInspector(PassRefPtr<FormData> formData, ExceptionC ode& ec) 693 void XMLHttpRequest::sendForInspector(ExceptionCode& ec)
694 {
695 m_allowCrossOriginRequests = true;
696 send(ec);
697 }
698
699 void XMLHttpRequest::sendForInspectorXHRReplay(PassRefPtr<FormData> formData, Ex ceptionCode& ec)
693 { 700 {
694 m_requestEntityBody = formData ? formData->deepCopy() : 0; 701 m_requestEntityBody = formData ? formData->deepCopy() : 0;
695 createRequest(ec); 702 createRequest(ec);
696 m_exceptionCode = ec; 703 m_exceptionCode = ec;
697 } 704 }
698 705
699 void XMLHttpRequest::createRequest(ExceptionCode& ec) 706 void XMLHttpRequest::createRequest(ExceptionCode& ec)
700 { 707 {
701 // Only GET request is supported for blob URL. 708 // Only GET request is supported for blob URL.
702 if (m_url.protocolIs("blob") && m_method != "GET") { 709 if (m_url.protocolIs("blob") && m_method != "GET") {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 743
737 if (m_requestHeaders.size() > 0) 744 if (m_requestHeaders.size() > 0)
738 request.addHTTPHeaderFields(m_requestHeaders); 745 request.addHTTPHeaderFields(m_requestHeaders);
739 746
740 ThreadableLoaderOptions options; 747 ThreadableLoaderOptions options;
741 options.sendLoadCallbacks = SendCallbacks; 748 options.sendLoadCallbacks = SendCallbacks;
742 options.sniffContent = DoNotSniffContent; 749 options.sniffContent = DoNotSniffContent;
743 options.preflightPolicy = uploadEvents ? ForcePreflight : ConsiderPreflight; 750 options.preflightPolicy = uploadEvents ? ForcePreflight : ConsiderPreflight;
744 options.allowCredentials = (m_sameOriginRequest || m_includeCredentials) ? A llowStoredCredentials : DoNotAllowStoredCredentials; 751 options.allowCredentials = (m_sameOriginRequest || m_includeCredentials) ? A llowStoredCredentials : DoNotAllowStoredCredentials;
745 options.credentialsRequested = m_includeCredentials ? ClientRequestedCredent ials : ClientDidNotRequestCredentials; 752 options.credentialsRequested = m_includeCredentials ? ClientRequestedCredent ials : ClientDidNotRequestCredentials;
746 options.crossOriginRequestPolicy = UseAccessControl; 753 options.crossOriginRequestPolicy = m_allowCrossOriginRequests ? AllowCrossOr iginRequests : UseAccessControl;
747 options.securityOrigin = securityOrigin(); 754 options.securityOrigin = securityOrigin();
748 options.initiator = cachedResourceRequestInitiators().xmlhttprequest; 755 options.initiator = cachedResourceRequestInitiators().xmlhttprequest;
749 options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypa ssMainWorld(scriptExecutionContext()) ? DoNotEnforceContentSecurityPolicy : Enfo rceConnectSrcDirective; 756 options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypa ssMainWorld(scriptExecutionContext()) ? DoNotEnforceContentSecurityPolicy : Enfo rceConnectSrcDirective;
750 757
751 #if ENABLE(XHR_TIMEOUT) 758 #if ENABLE(XHR_TIMEOUT)
752 if (m_timeoutMilliseconds) 759 if (m_timeoutMilliseconds)
753 request.setTimeoutInterval(m_timeoutMilliseconds / 1000.0); 760 request.setTimeoutInterval(m_timeoutMilliseconds / 1000.0);
754 #endif 761 #endif
755 762
756 m_exceptionCode = 0; 763 m_exceptionCode = 0;
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 info.addMember(m_responseDocument, "responseDocument"); 1287 info.addMember(m_responseDocument, "responseDocument");
1281 info.addMember(m_binaryResponseBuilder, "binaryResponseBuilder"); 1288 info.addMember(m_binaryResponseBuilder, "binaryResponseBuilder");
1282 info.addMember(m_responseArrayBuffer, "responseArrayBuffer"); 1289 info.addMember(m_responseArrayBuffer, "responseArrayBuffer");
1283 info.addMember(m_lastSendURL, "lastSendURL"); 1290 info.addMember(m_lastSendURL, "lastSendURL");
1284 info.addMember(m_eventTargetData, "eventTargetData"); 1291 info.addMember(m_eventTargetData, "eventTargetData");
1285 info.addMember(m_progressEventThrottle, "progressEventThrottle"); 1292 info.addMember(m_progressEventThrottle, "progressEventThrottle");
1286 info.addMember(m_securityOrigin, "securityOrigin"); 1293 info.addMember(m_securityOrigin, "securityOrigin");
1287 } 1294 }
1288 1295
1289 } // namespace WebCore 1296 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/xml/XMLHttpRequest.h ('k') | Source/devtools/protocol.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698