Chromium Code Reviews| Index: Source/core/xmlhttprequest/XMLHttpRequest.cpp |
| diff --git a/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
| index f10abe0c2f6232c1fa2d7783f2980af4b9082cee..303412b60fa9eca37a070f879d9fb6458a55dd16 100644 |
| --- a/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
| +++ b/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
| @@ -687,11 +687,16 @@ void XMLHttpRequest::setWithCredentials(bool value, ExceptionState& exceptionSta |
| m_includeCredentials = value; |
| } |
| -void XMLHttpRequest::open(const AtomicString& method, const KURL& url, ExceptionState& exceptionState) |
| +void XMLHttpRequest::open(const AtomicString& method, const String& url, ExceptionState& exceptionState) |
| { |
| open(method, url, true, exceptionState); |
| } |
| +void XMLHttpRequest::open(const AtomicString& method, const String& urlString, bool async, ExceptionState& exceptionState) |
| +{ |
| + open(method, executionContext()->completeURL(urlString), async, exceptionState); |
| +} |
| + |
| void XMLHttpRequest::open(const AtomicString& method, const KURL& url, bool async, ExceptionState& exceptionState) |
| { |
| WTF_LOG(Network, "XMLHttpRequest %p open('%s', '%s', %d)", this, method.utf8().data(), url.elidedString().utf8().data(), async); |
| @@ -763,19 +768,22 @@ void XMLHttpRequest::open(const AtomicString& method, const KURL& url, bool asyn |
| m_state = OPENED; |
| } |
| -void XMLHttpRequest::open(const AtomicString& method, const KURL& url, bool async, const String& user, ExceptionState& exceptionState) |
| +void XMLHttpRequest::open(const AtomicString& method, const String& urlString, bool async, const String& user, ExceptionState& exceptionState) |
| { |
| - KURL urlWithCredentials(url); |
| - urlWithCredentials.setUser(user); |
| + KURL urlWithCredentials(executionContext()->completeURL(urlString)); |
| + if (!user.isEmpty()) |
|
yhirano
2015/03/24 14:07:22
Can you tell me why you use isEmpty, not isNull? T
|
| + urlWithCredentials.setUser(user); |
| open(method, urlWithCredentials, async, exceptionState); |
| } |
| -void XMLHttpRequest::open(const AtomicString& method, const KURL& url, bool async, const String& user, const String& password, ExceptionState& exceptionState) |
| +void XMLHttpRequest::open(const AtomicString& method, const String& urlString, bool async, const String& user, const String& password, ExceptionState& exceptionState) |
| { |
| - KURL urlWithCredentials(url); |
| - urlWithCredentials.setUser(user); |
| - urlWithCredentials.setPass(password); |
| + KURL urlWithCredentials(executionContext()->completeURL(urlString)); |
| + if (!user.isEmpty()) |
| + urlWithCredentials.setUser(user); |
| + if (!password.isEmpty()) |
| + urlWithCredentials.setPass(password); |
| open(method, urlWithCredentials, async, exceptionState); |
| } |