[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
mjs
mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:14:30 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit a8679972b2ab455eac0fe4d16c4f73eb75dd6c22
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Nov 21 06:53:17 2003 +0000
Reviewed by Darin.
- fixed 3487201 - Implement abort for XMLHttpRequest async loads
* khtml/ecma/xmlhttprequest.cpp:
(KJS::XMLHttpRequest::abort): Kill and clear job.
(KJS::XMLHttpRequest::slotData): Avoid moving to state 3 on early abort.
(KJS::XMLHttpRequestProtoFunc::tryCall): Call abort when appropriate.
* khtml/ecma/xmlhttprequest.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 28cda47..7b7aa96 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,15 @@
+2003-11-20 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Darin.
+
+ - fixed 3487201 - Implement abort for XMLHttpRequest async loads
+
+ * khtml/ecma/xmlhttprequest.cpp:
+ (KJS::XMLHttpRequest::abort): Kill and clear job.
+ (KJS::XMLHttpRequest::slotData): Avoid moving to state 3 on early abort.
+ (KJS::XMLHttpRequestProtoFunc::tryCall): Call abort when appropriate.
+ * khtml/ecma/xmlhttprequest.h:
+
2003-11-20 John Sullivan <sullivan at apple.com>
- WebCore part of <rdar://problem/3183124>: Support page-break-before/after with a value of "always"
diff --git a/WebCore/khtml/ecma/xmlhttprequest.cpp b/WebCore/khtml/ecma/xmlhttprequest.cpp
index 01e5999..13d724b 100644
--- a/WebCore/khtml/ecma/xmlhttprequest.cpp
+++ b/WebCore/khtml/ecma/xmlhttprequest.cpp
@@ -166,9 +166,10 @@ XMLHttpRequest::XMLHttpRequest(ExecState *exec, const DOM::Document &d)
: DOMObject(XMLHttpRequestProto::self(exec)),
qObject(new XMLHttpRequestQObject(this)),
doc(static_cast<DOM::DocumentImpl*>(d.handle())),
+ async(true),
+ job(0),
state(Uninitialized),
onReadyStateChangeListener(0),
- async(true),
decoder(0)
{
}
@@ -207,15 +208,12 @@ void XMLHttpRequest::send(const QString& _body)
if (method.lower() == "post" && (url.protocol().lower() == "http" || url.protocol().lower() == "https") ) {
// FIXME: determine post encoding correctly by looking in headers for charset
job = KIO::http_post( url, QCString(_body.utf8()), false );
- job->addMetaData("content-type", "text/plain" );
}
else
{
job = KIO::get( url, false, false );
}
- // FIXME: should set referrer? args.metaData().insert("referrer", d->m_pageReferrer);
-
qObject->connect( job, SIGNAL( result( KIO::Job* ) ),
SLOT( slotFinished( KIO::Job* ) ) );
#if APPLE_CHANGES
@@ -235,6 +233,14 @@ void XMLHttpRequest::send(const QString& _body)
#endif
}
+void XMLHttpRequest::abort()
+{
+ if (job) {
+ job->kill();
+ job = 0;
+ }
+}
+
void XMLHttpRequest::slotFinished(KIO::Job *)
{
if (decoder) {
@@ -255,9 +261,9 @@ void XMLHttpRequest::slotRedirection(KIO::Job*, const KURL& url)
}
#if APPLE_CHANGES
-void XMLHttpRequest::slotData( KIO::Job* job, const char *data, int len )
+void XMLHttpRequest::slotData( KIO::Job* _job, const char *data, int len )
#else
-void XMLHttpRequest::slotData(KIO::Job*, const QByteArray &_data)
+void XMLHttpRequest::slotData(KIO::Job* _job, const QByteArray &_data)
#endif
{
if (state < Loaded) {
@@ -288,7 +294,9 @@ void XMLHttpRequest::slotData(KIO::Job*, const QByteArray &_data)
response += decoded;
- changeState(Interactive);
+ if (job != 0) {
+ changeState(Interactive);
+ }
}
Value XMLHttpRequestProtoFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
@@ -303,6 +311,7 @@ Value XMLHttpRequestProtoFunc::tryCall(ExecState *exec, Object &thisObj, const L
switch (id) {
case XMLHttpRequest::Abort:
+ request->abort();
return Undefined();
case XMLHttpRequest::GetAllResponseHeaders:
return Undefined();
diff --git a/WebCore/khtml/ecma/xmlhttprequest.h b/WebCore/khtml/ecma/xmlhttprequest.h
index ec570b8..94c238a 100644
--- a/WebCore/khtml/ecma/xmlhttprequest.h
+++ b/WebCore/khtml/ecma/xmlhttprequest.h
@@ -78,20 +78,23 @@ namespace KJS {
void open(const QString& _method, const KURL& _url, bool _async);
void send(const QString& _body);
+ void abort();
void changeState(XMLHttpRequestState newState);
QGuardedPtr<DOM::DocumentImpl> doc;
+
+ KURL url;
+ QString method;
+ bool async;
+
KIO::TransferJob * job;
+
XMLHttpRequestState state;
JSEventListener *onReadyStateChangeListener;
- QString method;
- KURL url;
- bool async;
khtml::Decoder *decoder;
QString encoding;
-
QString response;
};
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list