OLD | NEW |
---|---|
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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
680 } | 680 } |
681 | 681 |
682 // FIXME: According to XMLHttpRequest Level 2 we should throw InvalidAccessE rror exception here. | 682 // FIXME: According to XMLHttpRequest Level 2 we should throw InvalidAccessE rror exception here. |
683 // However for time being only print warning message to warn web developers. | 683 // However for time being only print warning message to warn web developers. |
684 if (!m_async) | 684 if (!m_async) |
685 UseCounter::countDeprecation(executionContext(), UseCounter::SyncXHRWith Credentials); | 685 UseCounter::countDeprecation(executionContext(), UseCounter::SyncXHRWith Credentials); |
686 | 686 |
687 m_includeCredentials = value; | 687 m_includeCredentials = value; |
688 } | 688 } |
689 | 689 |
690 void XMLHttpRequest::open(const AtomicString& method, const KURL& url, Exception State& exceptionState) | 690 void XMLHttpRequest::open(const AtomicString& method, const String& url, Excepti onState& exceptionState) |
691 { | 691 { |
692 open(method, url, true, exceptionState); | 692 open(method, url, true, exceptionState); |
693 } | 693 } |
694 | 694 |
695 void XMLHttpRequest::open(const AtomicString& method, const String& urlString, b ool async, ExceptionState& exceptionState) | |
696 { | |
697 open(method, executionContext()->completeURL(urlString), async, exceptionSta te); | |
698 } | |
699 | |
695 void XMLHttpRequest::open(const AtomicString& method, const KURL& url, bool asyn c, ExceptionState& exceptionState) | 700 void XMLHttpRequest::open(const AtomicString& method, const KURL& url, bool asyn c, ExceptionState& exceptionState) |
696 { | 701 { |
697 WTF_LOG(Network, "XMLHttpRequest %p open('%s', '%s', %d)", this, method.utf8 ().data(), url.elidedString().utf8().data(), async); | 702 WTF_LOG(Network, "XMLHttpRequest %p open('%s', '%s', %d)", this, method.utf8 ().data(), url.elidedString().utf8().data(), async); |
698 | 703 |
699 if (!internalAbort()) | 704 if (!internalAbort()) |
700 return; | 705 return; |
701 | 706 |
702 State previousState = m_state; | 707 State previousState = m_state; |
703 m_state = UNSENT; | 708 m_state = UNSENT; |
704 m_error = false; | 709 m_error = false; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
756 ASSERT(!m_loader); | 761 ASSERT(!m_loader); |
757 | 762 |
758 // Check previous state to avoid dispatching readyState event | 763 // Check previous state to avoid dispatching readyState event |
759 // when calling open several times in a row. | 764 // when calling open several times in a row. |
760 if (previousState != OPENED) | 765 if (previousState != OPENED) |
761 changeState(OPENED); | 766 changeState(OPENED); |
762 else | 767 else |
763 m_state = OPENED; | 768 m_state = OPENED; |
764 } | 769 } |
765 | 770 |
766 void XMLHttpRequest::open(const AtomicString& method, const KURL& url, bool asyn c, const String& user, ExceptionState& exceptionState) | 771 void XMLHttpRequest::open(const AtomicString& method, const String& urlString, b ool async, const String& user, ExceptionState& exceptionState) |
767 { | 772 { |
768 KURL urlWithCredentials(url); | 773 KURL urlWithCredentials(executionContext()->completeURL(urlString)); |
769 urlWithCredentials.setUser(user); | 774 if (!user.isEmpty()) |
yhirano
2015/03/24 14:07:22
Can you tell me why you use isEmpty, not isNull? T
| |
775 urlWithCredentials.setUser(user); | |
770 | 776 |
771 open(method, urlWithCredentials, async, exceptionState); | 777 open(method, urlWithCredentials, async, exceptionState); |
772 } | 778 } |
773 | 779 |
774 void XMLHttpRequest::open(const AtomicString& method, const KURL& url, bool asyn c, const String& user, const String& password, ExceptionState& exceptionState) | 780 void XMLHttpRequest::open(const AtomicString& method, const String& urlString, b ool async, const String& user, const String& password, ExceptionState& exception State) |
775 { | 781 { |
776 KURL urlWithCredentials(url); | 782 KURL urlWithCredentials(executionContext()->completeURL(urlString)); |
777 urlWithCredentials.setUser(user); | 783 if (!user.isEmpty()) |
778 urlWithCredentials.setPass(password); | 784 urlWithCredentials.setUser(user); |
785 if (!password.isEmpty()) | |
786 urlWithCredentials.setPass(password); | |
779 | 787 |
780 open(method, urlWithCredentials, async, exceptionState); | 788 open(method, urlWithCredentials, async, exceptionState); |
781 } | 789 } |
782 | 790 |
783 bool XMLHttpRequest::initSend(ExceptionState& exceptionState) | 791 bool XMLHttpRequest::initSend(ExceptionState& exceptionState) |
784 { | 792 { |
785 if (!executionContext()) | 793 if (!executionContext()) |
786 return false; | 794 return false; |
787 | 795 |
788 if (m_state != OPENED || m_loader) { | 796 if (m_state != OPENED || m_loader) { |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1866 visitor->trace(m_responseDocumentParser); | 1874 visitor->trace(m_responseDocumentParser); |
1867 visitor->trace(m_progressEventThrottle); | 1875 visitor->trace(m_progressEventThrottle); |
1868 visitor->trace(m_upload); | 1876 visitor->trace(m_upload); |
1869 visitor->trace(m_blobLoader); | 1877 visitor->trace(m_blobLoader); |
1870 XMLHttpRequestEventTarget::trace(visitor); | 1878 XMLHttpRequestEventTarget::trace(visitor); |
1871 DocumentParserClient::trace(visitor); | 1879 DocumentParserClient::trace(visitor); |
1872 ActiveDOMObject::trace(visitor); | 1880 ActiveDOMObject::trace(visitor); |
1873 } | 1881 } |
1874 | 1882 |
1875 } // namespace blink | 1883 } // namespace blink |
OLD | NEW |