Commit 8be93162 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Support undefined context value in Array.prototype.map.

parent 6d69c6db
......@@ -1074,11 +1074,12 @@ static HRESULT Array_map(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned
callback = get_object(argv[0]);
if(argc > 1) {
if(!is_object_instance(argv[1]) || !get_object(argv[1])) {
if(is_object_instance(argv[1]) && get_object(argv[1])) {
context_this = get_object(argv[1]);
}else if(!is_undefined(argv[1])) {
FIXME("Unsupported context this %s\n", debugstr_jsval(argv[1]));
return E_NOTIMPL;
}
context_this = get_object(argv[1]);
}
hres = create_array(ctx, length, &array);
......
......@@ -178,6 +178,13 @@ function test_array_map() {
ok(calls === "0:1,1:3,2:5,", "calls = " + calls);
ok(m.join() === "0,2,4", "m = " + m);
[1,2].map(function() {
ok(this === window, "this != window");
});
[1,2].map(function() {
ok(this === window, "this != window");
}, undefined);
next_test();
}
......
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