Commit 6e2a6cdc authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Implement onabort for XMLHttpRequest.

parent 29e0b0be
......@@ -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);
......
......@@ -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
];
......@@ -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)
......
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