Jacek Caban : jscript: Properly support missing array elements in Array.pop.

Alexandre Julliard julliard at winehq.org
Fri Mar 2 12:16:45 CST 2018


Module: wine
Branch: master
Commit: 89da4559ee72395cab21d48d8595aa7e5f2da33e
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=89da4559ee72395cab21d48d8595aa7e5f2da33e

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Mar  1 23:58:25 2018 +0100

jscript: Properly support missing array elements in Array.pop.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/jscript/array.c      | 5 +++--
 dlls/jscript/tests/api.js | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/jscript/array.c b/dlls/jscript/array.c
index b0deca0..90ff313 100644
--- a/dlls/jscript/array.c
+++ b/dlls/jscript/array.c
@@ -387,9 +387,10 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned
     hres = jsdisp_get_idx(jsthis, length, &val);
     if(SUCCEEDED(hres))
         hres = jsdisp_delete_idx(jsthis, length);
-    else if(hres == DISP_E_UNKNOWNNAME)
+    else if(hres == DISP_E_UNKNOWNNAME) {
         val = jsval_undefined();
-    else
+        hres = S_OK;
+    }else
         return hres;
 
     if(SUCCEEDED(hres))
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
index 084aa84..4207f5a 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -909,6 +909,8 @@ arr = [,,,,,];
 tmp = arr.pop();
 ok(arr.length === 5, "arr.length = " + arr.length);
 ok(tmp === undefined, "tmp = " + tmp);
+tmp = [1,2,,,].pop();
+ok(tmp === undefined, "tmp = " + tmp);
 
 function PseudoArray() {
     this[0] = 0;




More information about the wine-cvs mailing list