From 8d97a7b37ee01a80827a362631983aef51c988cb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gabriel=20Iv=C4=83ncescu?= Date: Mon, 25 Jul 2022 21:54:04 +0300 Subject: [PATCH] mshtml: Implement ProgressEvent's lengthComputable prop. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlevent.c | 13 +++++++++++-- dlls/mshtml/tests/xhr.js | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index 0d7f51a9b1e..3fac9c05309 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -2498,8 +2498,17 @@ static HRESULT WINAPI DOMProgressEvent_Invoke(IDOMProgressEvent *iface, DISPID d static HRESULT WINAPI DOMProgressEvent_get_lengthComputable(IDOMProgressEvent *iface, VARIANT_BOOL *p) { DOMProgressEvent *This = impl_from_IDOMProgressEvent(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsresult nsres; + cpp_bool b; + + TRACE("(%p)->(%p)\n", This, p); + + nsres = nsIDOMProgressEvent_GetLengthComputable(This->nsevent, &b); + if(NS_FAILED(nsres)) + return map_nsresult(nsres); + + *p = b ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; } static HRESULT WINAPI DOMProgressEvent_get_loaded(IDOMProgressEvent *iface, ULONGLONG *p) diff --git a/dlls/mshtml/tests/xhr.js b/dlls/mshtml/tests/xhr.js index 58665499052..9af44850a39 100644 --- a/dlls/mshtml/tests/xhr.js +++ b/dlls/mshtml/tests/xhr.js @@ -47,6 +47,7 @@ function test_xhr() { 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"); + ok(e.lengthComputable === false, "lengthComputable in loadstart = " + e.lengthComputable); loadstart = true; }; xhr.onloadend = function(e) { @@ -55,6 +56,7 @@ function test_xhr() { var props = [ "initProgressEvent", "lengthComputable", "loaded", "total" ]; for(var i = 0; i < props.length; i++) ok(props[i] in e, props[i] + " not available in loadend"); + ok(e.lengthComputable === true, "lengthComputable in loadend = " + e.lengthComputable); next_test(); }; } @@ -171,6 +173,9 @@ function test_timeout() { else ok(props[r] in e, props[r] + " not available"); } + if(v >= 10) { + ok(e.lengthComputable === false, "lengthComputable = " + e.lengthComputable); + } next_test(); } -- 2.11.4.GIT