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

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: compile fix 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
Index: Source/core/xmlhttprequest/XMLHttpRequest.cpp
diff --git a/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/Source/core/xmlhttprequest/XMLHttpRequest.cpp
index 0f4e892fe5ee55ef50746222b880aebaa3bf09d3..a49093f4a3ad011907303d495ea976a84db61bfa 100644
--- a/Source/core/xmlhttprequest/XMLHttpRequest.cpp
+++ b/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -701,14 +701,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)
@@ -782,26 +788,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())
@@ -818,12 +804,13 @@ bool XMLHttpRequest::initSend(ExceptionState& exceptionState)
void XMLHttpRequest::send(const ArrayBufferOrArrayBufferViewOrBlobOrDocumentOrStringOrFormData& data, ExceptionState& exceptionState)
{
+ InspectorInstrumentation::willSendXMLHttpRequest(executionContext(), url());
+
if (data.isNull()) {
- send(exceptionState);
+ send(String(), exceptionState);
return;
}
- InspectorInstrumentation::willSendXMLHttpRequest(executionContext(), url());
if (data.isArrayBuffer()) {
send(data.getAsArrayBuffer().get(), exceptionState);
return;
@@ -853,12 +840,6 @@ void XMLHttpRequest::send(const ArrayBufferOrArrayBufferViewOrBlobOrDocumentOrSt
send(data.getAsString(), exceptionState);
}
-void XMLHttpRequest::send(ExceptionState& exceptionState)
-{
- InspectorInstrumentation::willSendXMLHttpRequest(executionContext(), url());
- send(String(), exceptionState);
-}
-
bool XMLHttpRequest::areMethodAndURLValidForSend()
{
return m_method != "GET" && m_method != "HEAD" && m_url.protocolIsInHTTPFamily();

Powered by Google App Engine
This is Rietveld 408576698