jscript: Support undefined context value in Array.prototype.forEach.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ec8a3a78b8
commit
6d69c6db51
|
@ -959,16 +959,21 @@ static HRESULT Array_forEach(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
|
|||
|
||||
TRACE("\n");
|
||||
|
||||
/* FIXME: Check IsCallable */
|
||||
if(argc != 1 || !is_object_instance(argv[0])) {
|
||||
FIXME("Unsupported arguments\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
hres = get_length(ctx, vthis, &jsthis, &length);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
/* Fixme check IsCallable */
|
||||
if(!argc || !is_object_instance(argv[0]) || !get_object(argv[0])) {
|
||||
FIXME("Invalid arg %s\n", debugstr_jsval(argc ? argv[0] : jsval_undefined()));
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if(argc > 1 && !is_undefined(argv[1])) {
|
||||
FIXME("Unsupported context this %s\n", debugstr_jsval(argv[1]));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
for(i = 0; i < length; i++) {
|
||||
hres = jsdisp_get_idx(jsthis, i, &value);
|
||||
if(hres == DISP_E_UNKNOWNNAME)
|
||||
|
|
|
@ -109,6 +109,13 @@ function test_array_forEach() {
|
|||
test(new String("abc"), [[0,"a"],[1,"b"],[2,"c"]]);
|
||||
test([], []);
|
||||
|
||||
[1,2].forEach(function() {
|
||||
ok(this === window, "this != window");
|
||||
});
|
||||
[1,2].forEach(function() {
|
||||
ok(this === window, "this != window");
|
||||
}, undefined);
|
||||
|
||||
next_test();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue