Gabriel Ivăncescu : mshtml: Implement ProgressEvent's lengthComputable prop.

Alexandre Julliard julliard at winehq.org
Tue Jul 26 15:35:16 CDT 2022


Module: wine
Branch: master
Commit: 8d97a7b37ee01a80827a362631983aef51c988cb
URL:    https://gitlab.winehq.org/wine/wine/-/commit/8d97a7b37ee01a80827a362631983aef51c988cb

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Mon Jul 25 21:54:04 2022 +0300

mshtml: Implement ProgressEvent's lengthComputable prop.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>

---

 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();
     }
 




More information about the wine-cvs mailing list