Commit 8f91723a authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Implement onloadend for XMLHttpRequest.

parent 51e0deef
...@@ -157,6 +157,8 @@ static const event_info_t event_info[] = { ...@@ -157,6 +157,8 @@ static const event_info_t event_info[] = {
EVENT_DEFAULTLISTENER | EVENT_BUBBLES | EVENT_CANCELABLE}, EVENT_DEFAULTLISTENER | EVENT_BUBBLES | EVENT_CANCELABLE},
{L"load", EVENT_TYPE_UIEVENT, DISPID_EVMETH_ONLOAD, {L"load", EVENT_TYPE_UIEVENT, DISPID_EVMETH_ONLOAD,
EVENT_BIND_TO_TARGET}, EVENT_BIND_TO_TARGET},
{L"loadend", EVENT_TYPE_PROGRESS, DISPID_EVPROP_LOADEND,
EVENT_BIND_TO_TARGET},
{L"loadstart", EVENT_TYPE_PROGRESS, DISPID_EVPROP_LOADSTART, {L"loadstart", EVENT_TYPE_PROGRESS, DISPID_EVPROP_LOADSTART,
EVENT_BIND_TO_TARGET}, EVENT_BIND_TO_TARGET},
{L"message", EVENT_TYPE_MESSAGE, DISPID_EVMETH_ONMESSAGE, {L"message", EVENT_TYPE_MESSAGE, DISPID_EVMETH_ONMESSAGE,
......
...@@ -41,6 +41,7 @@ typedef enum { ...@@ -41,6 +41,7 @@ typedef enum {
EVENTID_KEYPRESS, EVENTID_KEYPRESS,
EVENTID_KEYUP, EVENTID_KEYUP,
EVENTID_LOAD, EVENTID_LOAD,
EVENTID_LOADEND,
EVENTID_LOADSTART, EVENTID_LOADSTART,
EVENTID_MESSAGE, EVENTID_MESSAGE,
EVENTID_MOUSEDOWN, EVENTID_MOUSEDOWN,
......
...@@ -25,7 +25,7 @@ function test_xhr() { ...@@ -25,7 +25,7 @@ function test_xhr() {
return; return;
ok(xhr.responseText === "Testing...", "unexpected responseText " + xhr.responseText); ok(xhr.responseText === "Testing...", "unexpected responseText " + xhr.responseText);
if(complete_cnt++) if(complete_cnt++ && !("onloadend" in xhr))
next_test(); next_test();
} }
xhr.ontimeout = function() { ok(false, "ontimeout called"); } xhr.ontimeout = function() { ok(false, "ontimeout called"); }
...@@ -33,7 +33,7 @@ function test_xhr() { ...@@ -33,7 +33,7 @@ function test_xhr() {
ok(xhr.statusText === "OK", "statusText = " + xhr.statusText); ok(xhr.statusText === "OK", "statusText = " + xhr.statusText);
if("onloadstart" in xhr) if("onloadstart" in xhr)
ok(loadstart, "onloadstart not fired"); ok(loadstart, "onloadstart not fired");
if(complete_cnt++) if(complete_cnt++ && !("onloadend" in xhr))
next_test(); next_test();
}; };
ok(xhr.onload === onload_func, "xhr.onload != onload_func"); ok(xhr.onload === onload_func, "xhr.onload != onload_func");
...@@ -45,6 +45,14 @@ function test_xhr() { ...@@ -45,6 +45,14 @@ function test_xhr() {
ok(props[i] in e, props[i] + " not available in loadstart"); ok(props[i] in e, props[i] + " not available in loadstart");
loadstart = true; loadstart = true;
}; };
xhr.onloadend = function(e) {
ok(complete_cnt == 2, "onloadend not fired after onload and onreadystatechange");
ok(loadstart, "onloadstart not fired before onloadend");
var props = [ "initProgressEvent", "lengthComputable", "loaded", "total" ];
for(var i = 0; i < props.length; i++)
ok(props[i] in e, props[i] + " not available in loadstart");
next_test();
};
} }
xhr.open("POST", "echo.php", true); xhr.open("POST", "echo.php", true);
......
...@@ -98,6 +98,7 @@ static const eventid_t events[] = { ...@@ -98,6 +98,7 @@ static const eventid_t events[] = {
EVENTID_READYSTATECHANGE, EVENTID_READYSTATECHANGE,
EVENTID_LOAD, EVENTID_LOAD,
EVENTID_LOADSTART, EVENTID_LOADSTART,
EVENTID_LOADEND,
EVENTID_PROGRESS, EVENTID_PROGRESS,
EVENTID_ABORT, EVENTID_ABORT,
EVENTID_ERROR, EVENTID_ERROR,
...@@ -1039,18 +1040,18 @@ static HRESULT WINAPI HTMLXMLHttpRequest_private_put_onloadend(IWineXMLHttpReque ...@@ -1039,18 +1040,18 @@ static HRESULT WINAPI HTMLXMLHttpRequest_private_put_onloadend(IWineXMLHttpReque
{ {
HTMLXMLHttpRequest *This = impl_from_IWineXMLHttpRequestPrivate(iface); 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_LOADEND, &v);
} }
static HRESULT WINAPI HTMLXMLHttpRequest_private_get_onloadend(IWineXMLHttpRequestPrivate *iface, VARIANT *p) static HRESULT WINAPI HTMLXMLHttpRequest_private_get_onloadend(IWineXMLHttpRequestPrivate *iface, VARIANT *p)
{ {
HTMLXMLHttpRequest *This = impl_from_IWineXMLHttpRequestPrivate(iface); 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_LOADEND, p);
} }
static const IWineXMLHttpRequestPrivateVtbl WineXMLHttpRequestPrivateVtbl = { static const IWineXMLHttpRequestPrivateVtbl WineXMLHttpRequestPrivateVtbl = {
......
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