Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
f207ded3
Commit
f207ded3
authored
Jun 03, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Support context argument in Array.prototype.forEach.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6682290d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
array.c
dlls/jscript/array.c
+8
-3
es5.js
dlls/mshtml/tests/es5.js
+6
-0
No files found.
dlls/jscript/array.c
View file @
f207ded3
...
...
@@ -949,6 +949,7 @@ static HRESULT Array_toLocaleString(script_ctx_t *ctx, vdisp_t *vthis, WORD flag
static
HRESULT
Array_forEach
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
IDispatch
*
context_obj
=
NULL
,
*
callback
;
jsval_t
value
,
args
[
3
],
res
;
jsdisp_t
*
jsthis
;
unsigned
length
,
i
;
...
...
@@ -965,10 +966,14 @@ static HRESULT Array_forEach(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
FIXME
(
"Invalid arg %s
\n
"
,
debugstr_jsval
(
argc
?
argv
[
0
]
:
jsval_undefined
()));
return
E_INVALIDARG
;
}
callback
=
get_object
(
argv
[
0
]);
if
(
argc
>
1
&&
!
is_undefined
(
argv
[
1
]))
{
FIXME
(
"Unsupported context this %s
\n
"
,
debugstr_jsval
(
argv
[
1
]));
return
E_NOTIMPL
;
if
(
!
is_object_instance
(
argv
[
1
])
||
!
get_object
(
argv
[
1
]))
{
FIXME
(
"Unsupported context this %s
\n
"
,
debugstr_jsval
(
argv
[
1
]));
return
E_NOTIMPL
;
}
context_obj
=
get_object
(
argv
[
1
]);
}
for
(
i
=
0
;
i
<
length
;
i
++
)
{
...
...
@@ -981,7 +986,7 @@ static HRESULT Array_forEach(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
args
[
0
]
=
value
;
args
[
1
]
=
jsval_number
(
i
);
args
[
2
]
=
jsval_obj
(
jsthis
);
hres
=
disp_call_value
(
ctx
,
get_object
(
argv
[
0
]),
NULL
,
DISPATCH_METHOD
,
ARRAY_SIZE
(
args
),
args
,
&
res
);
hres
=
disp_call_value
(
ctx
,
callback
,
context_obj
,
DISPATCH_METHOD
,
ARRAY_SIZE
(
args
),
args
,
&
res
);
jsval_release
(
value
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/mshtml/tests/es5.js
View file @
f207ded3
...
...
@@ -116,6 +116,12 @@ function test_array_forEach() {
ok
(
this
===
window
,
"this != window"
);
},
undefined
);
var
o
=
new
Object
(),
a
=
[
1
,
2
];
a
.
forEach
(
function
(
value
,
index
,
array
)
{
ok
(
array
===
a
,
"array != a"
);
ok
(
this
===
o
,
"this != o"
);
},
o
);
next_test
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment