Commit 880c7a4f authored by weinig@apple.com's avatar weinig@apple.com

2008-06-25 Sam Weinig <sam@webkit.org>

        Reviewed by Brady Eidson.

        Move XMLHttpRequestState enum into XMLHttpRequest and rename to State.

        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::readyState):
        (WebCore::XMLHttpRequest::changeState):
        (WebCore::XMLHttpRequest::open):
        * xml/XMLHttpRequest.h:
        (WebCore::XMLHttpRequest::create):
        (WebCore::XMLHttpRequest::):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34801 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d5f3b85e
2008-06-25 Sam Weinig <sam@webkit.org>
Reviewed by Brady Eidson.
Move XMLHttpRequestState enum into XMLHttpRequest and rename to State.
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::readyState):
(WebCore::XMLHttpRequest::changeState):
(WebCore::XMLHttpRequest::open):
* xml/XMLHttpRequest.h:
(WebCore::XMLHttpRequest::create):
(WebCore::XMLHttpRequest::):
2008-06-25 Justin Garcia <justin.garcia@apple.com>
Reviewed by John.
......@@ -164,7 +164,7 @@ XMLHttpRequest::~XMLHttpRequest()
removeFromRequestsByDocument(m_doc, this);
}
XMLHttpRequestState XMLHttpRequest::readyState() const
XMLHttpRequest::State XMLHttpRequest::readyState() const
{
return m_state;
}
......@@ -251,7 +251,7 @@ bool XMLHttpRequest::dispatchEvent(PassRefPtr<Event> evt, ExceptionCode& ec, boo
return !evt->defaultPrevented();
}
void XMLHttpRequest::changeState(XMLHttpRequestState newState)
void XMLHttpRequest::changeState(State newState)
{
if (m_state != newState) {
m_state = newState;
......@@ -273,7 +273,7 @@ void XMLHttpRequest::callReadyStateChangeListener()
void XMLHttpRequest::open(const String& method, const KURL& url, bool async, ExceptionCode& ec)
{
internalAbort();
XMLHttpRequestState previousState = m_state;
State previousState = m_state;
m_state = UNSENT;
m_error = false;
......
......@@ -34,20 +34,20 @@ class Document;
class File;
class TextResourceDecoder;
// these exact numeric values are important because JS expects them
enum XMLHttpRequestState {
UNSENT = 0, // The object has been constructed.
OPENED = 1, // The open() method has been successfully invoked. During this state request headers can be set using setRequestHeader() and the request can be made using the send() method.
HEADERS_RECEIVED = 2, // All HTTP headers have been received. Several response members of the object are now available.
LOADING = 3, // The response entity body is being received.
DONE = 4 // The data transfer has been completed or something went wrong during the transfer (such as infinite redirects)..
};
class XMLHttpRequest : public RefCounted<XMLHttpRequest>, public EventTarget, private SubresourceLoaderClient {
public:
static PassRefPtr<XMLHttpRequest> create(Document *document) { return adoptRef(new XMLHttpRequest(document)); }
static PassRefPtr<XMLHttpRequest> create(Document* document) { return adoptRef(new XMLHttpRequest(document)); }
~XMLHttpRequest();
// These exact numeric values are important because JS expects them.
enum State {
UNSENT = 0,
OPENED = 1,
HEADERS_RECEIVED = 2,
LOADING = 3,
DONE = 4
};
virtual XMLHttpRequest* toXMLHttpRequest() { return this; }
static void detachRequests(Document*);
......@@ -55,7 +55,7 @@ public:
String statusText(ExceptionCode&) const;
int status(ExceptionCode&) const;
XMLHttpRequestState readyState() const;
State readyState() const;
void open(const String& method, const KURL&, bool async, ExceptionCode&);
void open(const String& method, const KURL&, bool async, const String& user, ExceptionCode&);
void open(const String& method, const KURL&, bool async, const String& user, const String& password, ExceptionCode&);
......@@ -130,7 +130,7 @@ private:
String getRequestHeader(const String& name) const;
void setRequestHeaderInternal(const String& name, const String& value);
void changeState(XMLHttpRequestState newState);
void changeState(State newState);
void callReadyStateChangeListener();
void dropProtection();
void internalAbort();
......@@ -179,7 +179,7 @@ private:
bool m_async;
RefPtr<SubresourceLoader> m_loader;
XMLHttpRequestState m_state;
State m_state;
ResourceResponse m_response;
String m_responseEncoding;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment