Commit 399f8b6f authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

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

parent 477026a5
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment