Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/tests/script.c | 2 ++ dlls/mshtml/tests/xhr.js | 20 ++++++++++++++++++++ dlls/mshtml/xmlhttprequest.c | 9 +++++---- 3 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/tests/script.c b/dlls/mshtml/tests/script.c index 401e130..e368824 100644 --- a/dlls/mshtml/tests/script.c +++ b/dlls/mshtml/tests/script.c @@ -3079,6 +3079,8 @@ static void report_data(ProtocolHandler *This)
hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate, &IID_IHttpNegotiate, (void**)&http_negotiate); IServiceProvider_Release(service_provider); + if(This->delay && hres == E_FAIL) /* aborted too quickly */ + return; ok(hres == S_OK, "Could not get IHttpNegotiate interface: %08lx\n", hres);
hres = IUri_GetDisplayUri(This->uri, &url); diff --git a/dlls/mshtml/tests/xhr.js b/dlls/mshtml/tests/xhr.js index 6228f73..dd86331 100644 --- a/dlls/mshtml/tests/xhr.js +++ b/dlls/mshtml/tests/xhr.js @@ -41,6 +41,25 @@ function test_xhr() { xhr.send("Testing..."); }
+function test_abort() { + var xhr = new XMLHttpRequest(); + if(!("onabort" in xhr)) { next_test(); return; } + + xhr.onreadystatechange = function() { + if(xhr.readyState != 4) + return; + todo_wine_if(v < 10). + ok(v >= 10, "onreadystatechange called"); + } + xhr.onload = function() { ok(false, "onload called"); } + xhr.onabort = function(e) { next_test(); } + + xhr.open("POST", "echo.php?delay", true); + xhr.setRequestHeader("X-Test", "True"); + xhr.send("Abort Test"); + xhr.abort(); +} + function test_timeout() { var xhr = new XMLHttpRequest(); var v = document.documentMode; @@ -74,5 +93,6 @@ function test_timeout() {
var tests = [ test_xhr, + test_abort, test_timeout ]; diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index 12356f1..54e84cf 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -97,6 +97,7 @@ static HRESULT return_nscstr(nsresult nsres, nsACString *nscstr, BSTR *p) static const eventid_t events[] = { EVENTID_READYSTATECHANGE, EVENTID_LOAD, + EVENTID_ABORT, EVENTID_ERROR, EVENTID_TIMEOUT, }; @@ -982,18 +983,18 @@ static HRESULT WINAPI HTMLXMLHttpRequest_private_put_onabort(IWineXMLHttpRequest { HTMLXMLHttpRequest *This = impl_from_IWineXMLHttpRequestPrivate(iface);
- FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
- return E_NOTIMPL; + return set_event_handler(&This->event_target, EVENTID_ABORT, &v); }
static HRESULT WINAPI HTMLXMLHttpRequest_private_get_onabort(IWineXMLHttpRequestPrivate *iface, VARIANT *p) { HTMLXMLHttpRequest *This = impl_from_IWineXMLHttpRequestPrivate(iface);
- FIXME("(%p)->(%p)\n", This, p); + TRACE("(%p)->(%p)\n", This, p);
- return E_NOTIMPL; + return get_event_handler(&This->event_target, EVENTID_ABORT, p); }
static HRESULT WINAPI HTMLXMLHttpRequest_private_put_onprogress(IWineXMLHttpRequestPrivate *iface, VARIANT v)