summaryrefslogtreecommitdiffstats
path: root/WebCore/xml/XMLHttpRequest.h
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/xml/XMLHttpRequest.h')
-rw-r--r--WebCore/xml/XMLHttpRequest.h60
1 files changed, 35 insertions, 25 deletions
diff --git a/WebCore/xml/XMLHttpRequest.h b/WebCore/xml/XMLHttpRequest.h
index 6962ab1..d7c0d36 100644
--- a/WebCore/xml/XMLHttpRequest.h
+++ b/WebCore/xml/XMLHttpRequest.h
@@ -26,18 +26,21 @@
#include "EventTarget.h"
#include "FormData.h"
#include "ResourceResponse.h"
-#include "SubresourceLoaderClient.h"
+#include "ScriptString.h"
+#include "ThreadableLoaderClient.h"
#include <wtf/OwnPtr.h>
namespace WebCore {
class Document;
class File;
+class ResourceRequest;
class TextResourceDecoder;
+class ThreadableLoader;
-class XMLHttpRequest : public RefCounted<XMLHttpRequest>, public EventTarget, private SubresourceLoaderClient, public ActiveDOMObject {
+class XMLHttpRequest : public RefCounted<XMLHttpRequest>, public EventTarget, private ThreadableLoaderClient, public ActiveDOMObject {
public:
- static PassRefPtr<XMLHttpRequest> create(Document* document) { return adoptRef(new XMLHttpRequest(document)); }
+ static PassRefPtr<XMLHttpRequest> create(ScriptExecutionContext* context) { return adoptRef(new XMLHttpRequest(context)); }
~XMLHttpRequest();
// These exact numeric values are important because JS expects them.
@@ -52,6 +55,7 @@ public:
virtual XMLHttpRequest* toXMLHttpRequest() { return this; }
virtual void contextDestroyed();
+ virtual bool canSuspend() const;
virtual void stop();
virtual ScriptExecutionContext* scriptExecutionContext() const;
@@ -67,14 +71,14 @@ public:
void send(const String&, ExceptionCode&);
void send(File*, ExceptionCode&);
void abort();
- void setRequestHeader(const String& name, const String& value, ExceptionCode&);
+ void setRequestHeader(const AtomicString& name, const String& value, ExceptionCode&);
void overrideMimeType(const String& override);
String getAllResponseHeaders(ExceptionCode&) const;
- String getResponseHeader(const String& name, ExceptionCode&) const;
- const JSC::UString& responseText() const;
+ String getResponseHeader(const AtomicString& name, ExceptionCode&) const;
+ const ScriptString& responseText() const;
Document* responseXML() const;
void setLastSendLineNumber(unsigned lineNumber) { m_lastSendLineNumber = lineNumber; }
- void setLastSendURL(JSC::UString url) { m_lastSendURL = url; }
+ void setLastSendURL(const String& url) { m_lastSendURL = url; }
XMLHttpRequestUpload* upload();
XMLHttpRequestUpload* optionalUpload() const { return m_upload.get(); }
@@ -110,26 +114,30 @@ public:
using RefCounted<XMLHttpRequest>::deref;
private:
- XMLHttpRequest(Document*);
+ XMLHttpRequest(ScriptExecutionContext*);
virtual void refEventTarget() { ref(); }
virtual void derefEventTarget() { deref(); }
Document* document() const;
- virtual void willSendRequest(SubresourceLoader*, ResourceRequest& request, const ResourceResponse& redirectResponse);
- virtual void didSendData(SubresourceLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
- virtual void didReceiveResponse(SubresourceLoader*, const ResourceResponse&);
- virtual void didReceiveData(SubresourceLoader*, const char* data, int size);
- virtual void didFail(SubresourceLoader*, const ResourceError&);
- virtual void didFinishLoading(SubresourceLoader*);
- virtual void receivedCancellation(SubresourceLoader*, const AuthenticationChallenge&);
+#if ENABLE(DASHBOARD_SUPPORT)
+ bool usesDashboardBackwardCompatibilityMode() const;
+#endif
+
+ virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
+ virtual void didReceiveResponse(const ResourceResponse&);
+ virtual void didReceiveData(const char* data, int lengthReceived);
+ virtual void didFinishLoading(unsigned long identifier);
+ virtual void didFail();
+ virtual void didGetCancelled();
+ virtual void didReceiveAuthenticationCancellation(const ResourceResponse&);
// Special versions for the preflight
- void didReceiveResponsePreflight(SubresourceLoader*, const ResourceResponse&);
- void didFinishLoadingPreflight(SubresourceLoader*);
+ void didReceiveResponsePreflight(const ResourceResponse&);
+ void didFinishLoadingPreflight();
- void processSyncLoadResults(const Vector<char>& data, const ResourceResponse&, ExceptionCode&);
+ void processSyncLoadResults(unsigned long identifier, const Vector<char>& data, const ResourceResponse&, ExceptionCode&);
void updateAndDispatchOnProgress(unsigned int len);
String responseMIMEType() const;
@@ -137,8 +145,9 @@ private:
bool initSend(ExceptionCode&);
- String getRequestHeader(const String& name) const;
- void setRequestHeaderInternal(const String& name, const String& value);
+ String getRequestHeader(const AtomicString& name) const;
+ void setRequestHeaderInternal(const AtomicString& name, const String& value);
+ bool isSafeRequestHeader(const String&) const;
void changeState(State newState);
void callReadyStateChangeListener();
@@ -159,6 +168,8 @@ private:
void loadRequestSynchronously(ResourceRequest&, ExceptionCode&);
void loadRequestAsynchronously(ResourceRequest&);
+ bool isOnAccessControlResponseHeaderWhitelist(const String&) const;
+
bool isSimpleCrossSiteAccessRequest() const;
String accessControlOrigin() const;
bool accessControlCheck(const ResourceResponse&);
@@ -193,22 +204,21 @@ private:
bool m_async;
bool m_includeCredentials;
- RefPtr<SubresourceLoader> m_loader;
+ RefPtr<ThreadableLoader> m_loader;
State m_state;
ResourceResponse m_response;
String m_responseEncoding;
RefPtr<TextResourceDecoder> m_decoder;
- unsigned long m_identifier;
- // Unlike most strings in the DOM, we keep this as a JSC::UString, not a WebCore::String.
+ // Unlike most strings in the DOM, we keep this as a ScriptString, not a WebCore::String.
// That's because these strings can easily get huge (they are filled from the network with
// no parsing) and because JS can easily observe many intermediate states, so it's very useful
// to be able to share the buffer with JavaScript versions of the whole or partial string.
// In contrast, this string doesn't interact much with the rest of the engine so it's not that
// big a cost that it isn't a String.
- JSC::UString m_responseText;
+ ScriptString m_responseText;
mutable bool m_createdDocument;
mutable RefPtr<Document> m_responseXML;
@@ -224,7 +234,7 @@ private:
long long m_receivedLength;
unsigned m_lastSendLineNumber;
- JSC::UString m_lastSendURL;
+ String m_lastSendURL;
};
} // namespace WebCore