Gabriel Ivăncescu : jscript: Pass the Map object to the callback when iterating.

Alexandre Julliard julliard at winehq.org
Thu Apr 14 16:50:34 CDT 2022


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

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Thu Apr 14 19:24:42 2022 +0300

jscript: Pass the Map object to the callback when iterating.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/jscript/set.c                | 3 ++-
 dlls/mshtml/tests/documentmode.js | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/jscript/set.c b/dlls/jscript/set.c
index 640bf44b5f4..dd6829d9b6d 100644
--- a/dlls/jscript/set.c
+++ b/dlls/jscript/set.c
@@ -179,11 +179,12 @@ static HRESULT iterate_map(MapInstance *map, script_ctx_t *ctx, unsigned argc, j
     }
 
     LIST_FOR_EACH_ENTRY(entry, &map->entries, struct jsval_map_entry, list_entry) {
-        jsval_t args[2], v;
+        jsval_t args[3], v;
         if(entry->deleted)
             continue;
         args[0] = entry->value;
         args[1] = entry->key;
+        args[2] = jsval_obj(&map->dispex);
         grab_map_entry(entry);
         hres = disp_call_value(ctx, get_object(argv[0]), NULL, DISPATCH_METHOD,
                                ARRAY_SIZE(args), args, &v);
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js
index 28450f721bb..ed41ac1d7a7 100644
--- a/dlls/mshtml/tests/documentmode.js
+++ b/dlls/mshtml/tests/documentmode.js
@@ -995,7 +995,7 @@ sync_test("map_obj", function() {
 
     var calls = [];
     i = 0;
-    r = s.forEach(function(value, key) {
+    r = s.forEach(function(value, key, map) {
         if(isNaN(test_keys[i])) {
             ok(isNaN(key), "key = " + key + " expected NaN");
             ok(isNaN(value), "value = " + value + " expected NaN");
@@ -1003,6 +1003,7 @@ sync_test("map_obj", function() {
             ok(key === test_keys[i], "key = " + key + " expected " + test_keys[i]);
             ok(value === key + 1, "value = " + value);
         }
+        ok(map === s, "map = " + map);
         i++;
     });
     ok(i === test_keys.length, "i = " + i);




More information about the wine-cvs mailing list