[PATCH 0/1] MR4109: jscript: Fix Array.map and Array.reduce when last element doesn't exist.
I've fixed the `beforeunload` case, since it happens during `load_nsuri`. I added tests for both it and `unload`, but unfortunately the new tests are somewhat hackish, as we have to release the View without actually closing it to test this, because closing the view sends those events (this is already tested by existing tests), and we want to test if releasing the doc obj sends those events. As for why we have to release the View, it's because it holds a ref to the doc obj. So I placed the test last now since it doesn't close the view properly. If you think the test is too hackish I can remove it. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4109
From: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> --- dlls/jscript/array.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/jscript/array.c b/dlls/jscript/array.c index 48f665da576..20213be4ea7 100644 --- a/dlls/jscript/array.c +++ b/dlls/jscript/array.c @@ -1360,8 +1360,10 @@ static HRESULT Array_map(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned for(k = 0; k < length; k++) { hres = jsdisp_get_idx(jsthis, k, &callback_args[0]); - if(hres == DISP_E_UNKNOWNNAME) + if(hres == DISP_E_UNKNOWNNAME) { + hres = S_OK; continue; + } if(FAILED(hres)) break; @@ -1420,8 +1422,10 @@ static HRESULT Array_reduce(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsign for(k = 0; k < length; k++) { hres = jsdisp_get_idx(jsthis, k, &callback_args[1]); - if(hres == DISP_E_UNKNOWNNAME) + if(hres == DISP_E_UNKNOWNNAME) { + hres = S_OK; continue; + } if(FAILED(hres)) break; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4109
Please add a test. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4109#note_48824
On Mon Oct 16 18:14:04 2023 +0000, Jacek Caban wrote:
Please add a test. Sorry, I thought it was obvious, but of course I found another issue while testing, so now I also split them up into two patches and added tests.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/4109#note_48827
participants (2)
-
Gabriel Ivăncescu -
Jacek Caban (@jacek)