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

Unified Diff: Source/core/xmlhttprequest/XMLHttpRequest.cpp

Issue 1167563002: Sync the XHR-related interfaces with the spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: data->body Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/xmlhttprequest/XMLHttpRequest.h ('k') | Source/core/xmlhttprequest/XMLHttpRequest.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xmlhttprequest/XMLHttpRequest.cpp
diff --git a/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/Source/core/xmlhttprequest/XMLHttpRequest.cpp
index 40db8e8afc0f4a15756134fc823bcbddd5d9b0ac..4ce961a1762f7f990ece57f0ee05e101eec8552b 100644
--- a/Source/core/xmlhttprequest/XMLHttpRequest.cpp
+++ b/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -700,14 +700,20 @@ void XMLHttpRequest::setWithCredentials(bool value, ExceptionState& exceptionSta
m_includeCredentials = value;
}
-void XMLHttpRequest::open(const AtomicString& method, const String& url, ExceptionState& exceptionState)
+void XMLHttpRequest::open(const AtomicString& method, const String& urlString, ExceptionState& exceptionState)
{
- open(method, url, true, exceptionState);
+ open(method, executionContext()->completeURL(urlString), true, exceptionState);
}
-void XMLHttpRequest::open(const AtomicString& method, const String& urlString, bool async, ExceptionState& exceptionState)
+void XMLHttpRequest::open(const AtomicString& method, const String& urlString, bool async, const String& username, const String& password, ExceptionState& exceptionState)
{
- open(method, executionContext()->completeURL(urlString), async, exceptionState);
+ KURL url(executionContext()->completeURL(urlString));
+ if (!username.isNull())
+ url.setUser(username);
+ if (!password.isNull())
+ url.setPass(password);
+
+ open(method, url, async, exceptionState);
}
void XMLHttpRequest::open(const AtomicString& method, const KURL& url, bool async, ExceptionState& exceptionState)
@@ -781,26 +787,6 @@ void XMLHttpRequest::open(const AtomicString& method, const KURL& url, bool asyn
m_state = OPENED;
}
-void XMLHttpRequest::open(const AtomicString& method, const String& urlString, bool async, const String& user, ExceptionState& exceptionState)
-{
- KURL urlWithCredentials(executionContext()->completeURL(urlString));
- if (!user.isNull())
- urlWithCredentials.setUser(user);
-
- open(method, urlWithCredentials, async, exceptionState);
-}
-
-void XMLHttpRequest::open(const AtomicString& method, const String& urlString, bool async, const String& user, const String& password, ExceptionState& exceptionState)
-{
- KURL urlWithCredentials(executionContext()->completeURL(urlString));
- if (!user.isNull())
- urlWithCredentials.setUser(user);
- if (!password.isNull())
- urlWithCredentials.setPass(password);
-
- open(method, urlWithCredentials, async, exceptionState);
-}
-
bool XMLHttpRequest::initSend(ExceptionState& exceptionState)
{
if (!executionContext())
@@ -815,47 +801,42 @@ bool XMLHttpRequest::initSend(ExceptionState& exceptionState)
return true;
}
-void XMLHttpRequest::send(const ArrayBufferOrArrayBufferViewOrBlobOrDocumentOrStringOrFormData& data, ExceptionState& exceptionState)
+void XMLHttpRequest::send(const ArrayBufferOrArrayBufferViewOrBlobOrDocumentOrStringOrFormData& body, ExceptionState& exceptionState)
{
- if (data.isNull()) {
- send(exceptionState);
+ InspectorInstrumentation::willSendXMLHttpRequest(executionContext(), url());
+
+ if (body.isNull()) {
+ send(String(), exceptionState);
return;
}
- InspectorInstrumentation::willSendXMLHttpRequest(executionContext(), url());
- if (data.isArrayBuffer()) {
- send(data.getAsArrayBuffer().get(), exceptionState);
+ if (body.isArrayBuffer()) {
+ send(body.getAsArrayBuffer().get(), exceptionState);
return;
}
- if (data.isArrayBufferView()) {
- send(data.getAsArrayBufferView().get(), exceptionState);
+ if (body.isArrayBufferView()) {
+ send(body.getAsArrayBufferView().get(), exceptionState);
return;
}
- if (data.isBlob()) {
- send(data.getAsBlob(), exceptionState);
+ if (body.isBlob()) {
+ send(body.getAsBlob(), exceptionState);
return;
}
- if (data.isDocument()) {
- send(data.getAsDocument().get(), exceptionState);
+ if (body.isDocument()) {
+ send(body.getAsDocument().get(), exceptionState);
return;
}
- if (data.isFormData()) {
- send(data.getAsFormData(), exceptionState);
+ if (body.isFormData()) {
+ send(body.getAsFormData(), exceptionState);
return;
}
- ASSERT(data.isString());
- send(data.getAsString(), exceptionState);
-}
-
-void XMLHttpRequest::send(ExceptionState& exceptionState)
-{
- InspectorInstrumentation::willSendXMLHttpRequest(executionContext(), url());
- send(String(), exceptionState);
+ ASSERT(body.isString());
+ send(body.getAsString(), exceptionState);
}
bool XMLHttpRequest::areMethodAndURLValidForSend()
« no previous file with comments | « Source/core/xmlhttprequest/XMLHttpRequest.h ('k') | Source/core/xmlhttprequest/XMLHttpRequest.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698