Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlevent.c | 2 ++ dlls/mshtml/htmlevent.h | 1 + dlls/mshtml/tests/xhr.js | 13 ++++++++++++- dlls/mshtml/xmlhttprequest.c | 9 +++++---- 4 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index cf0de22..a718ad4 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -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, diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h index 3f399da..6af8119 100644 --- a/dlls/mshtml/htmlevent.h +++ b/dlls/mshtml/htmlevent.h @@ -41,6 +41,7 @@ typedef enum { EVENTID_KEYPRESS, EVENTID_KEYUP, EVENTID_LOAD, + EVENTID_LOADSTART, EVENTID_MESSAGE, EVENTID_MOUSEDOWN, EVENTID_MOUSEMOVE, diff --git a/dlls/mshtml/tests/xhr.js b/dlls/mshtml/tests/xhr.js index dd86331..d706897 100644 --- a/dlls/mshtml/tests/xhr.js +++ b/dlls/mshtml/tests/xhr.js @@ -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"); diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index b5973c3..b783d04 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_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)