Commit 51e0deef authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Implement onloadstart for XMLHttpRequest.

parent 7c45b742
......@@ -157,6 +157,8 @@ static const event_info_t event_info[] = {
EVENT_DEFAULTLISTENER | EVENT_BUBBLES | EVENT_CANCELABLE},
{L"load", EVENT_TYPE_UIEVENT, DISPID_EVMETH_ONLOAD,
EVENT_BIND_TO_TARGET},
{L"loadstart", EVENT_TYPE_PROGRESS, DISPID_EVPROP_LOADSTART,
EVENT_BIND_TO_TARGET},
{L"message", EVENT_TYPE_MESSAGE, DISPID_EVMETH_ONMESSAGE,
0},
{L"mousedown", EVENT_TYPE_MOUSE, DISPID_EVMETH_ONMOUSEDOWN,
......
......@@ -41,6 +41,7 @@ typedef enum {
EVENTID_KEYPRESS,
EVENTID_KEYUP,
EVENTID_LOAD,
EVENTID_LOADSTART,
EVENTID_MESSAGE,
EVENTID_MOUSEDOWN,
EVENTID_MOUSEMOVE,
......
......@@ -18,7 +18,7 @@
function test_xhr() {
var xhr = new XMLHttpRequest();
var complete_cnt = 0;
var complete_cnt = 0, loadstart = false;
xhr.onreadystatechange = function() {
if(xhr.readyState != 4)
......@@ -31,10 +31,21 @@ function test_xhr() {
xhr.ontimeout = function() { ok(false, "ontimeout called"); }
var onload_func = xhr.onload = function() {
ok(xhr.statusText === "OK", "statusText = " + xhr.statusText);
if("onloadstart" in xhr)
ok(loadstart, "onloadstart not fired");
if(complete_cnt++)
next_test();
};
ok(xhr.onload === onload_func, "xhr.onload != onload_func");
if("onloadstart" in xhr) {
xhr.onloadstart = function(e) {
ok(complete_cnt == 0, "onloadstart fired after onload");
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");
loadstart = true;
};
}
xhr.open("POST", "echo.php", true);
xhr.setRequestHeader("X-Test", "True");
......
......@@ -97,6 +97,7 @@ static HRESULT return_nscstr(nsresult nsres, nsACString *nscstr, BSTR *p)
static const eventid_t events[] = {
EVENTID_READYSTATECHANGE,
EVENTID_LOAD,
EVENTID_LOADSTART,
EVENTID_PROGRESS,
EVENTID_ABORT,
EVENTID_ERROR,
......@@ -1020,18 +1021,18 @@ static HRESULT WINAPI HTMLXMLHttpRequest_private_put_onloadstart(IWineXMLHttpReq
{
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_LOADSTART, &v);
}
static HRESULT WINAPI HTMLXMLHttpRequest_private_get_onloadstart(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_LOADSTART, p);
}
static HRESULT WINAPI HTMLXMLHttpRequest_private_put_onloadend(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