Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
710219a5
Commit
710219a5
authored
Oct 30, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 30, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Pass global object as this if 'this' argument is null or undefined in Function.apply.
parent
0e2132fa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
function.c
dlls/jscript/function.c
+9
-5
api.js
dlls/jscript/tests/api.js
+3
-0
No files found.
dlls/jscript/function.c
View file @
710219a5
...
...
@@ -403,9 +403,13 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI
argc
=
arg_cnt
(
dp
);
if
(
argc
)
{
hres
=
to_object
(
ctx
,
get_arg
(
dp
,
0
),
&
this_obj
);
if
(
FAILED
(
hres
))
return
hres
;
VARIANT
*
v
=
get_arg
(
dp
,
0
);
if
(
V_VT
(
v
)
!=
VT_EMPTY
&&
V_VT
(
v
)
!=
VT_NULL
)
{
hres
=
to_object
(
ctx
,
v
,
&
this_obj
);
if
(
FAILED
(
hres
))
return
hres
;
}
}
if
(
argc
>=
2
)
{
...
...
@@ -413,8 +417,8 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI
if
(
V_VT
(
get_arg
(
dp
,
1
))
==
VT_DISPATCH
)
{
arg_array
=
iface_to_jsdisp
((
IUnknown
*
)
V_DISPATCH
(
get_arg
(
dp
,
1
)));
if
(
arg_array
&&
(
!
is_class
(
arg_array
,
JSCLASS_ARRAY
)
&&
!
is_class
(
arg_array
,
JSCLASS_ARGUMENTS
)
))
{
if
(
arg_array
&&
(
!
is_class
(
arg_array
,
JSCLASS_ARRAY
)
&&
!
is_class
(
arg_array
,
JSCLASS_ARGUMENTS
)
))
{
jsdisp_release
(
arg_array
);
arg_array
=
NULL
;
}
...
...
dlls/jscript/tests/api.js
View file @
710219a5
...
...
@@ -1402,6 +1402,9 @@ function callTest3() {
callTest3
.
call
();
callTest3
.
call
(
undefined
);
callTest3
.
call
(
null
);
callTest3
.
apply
();
callTest3
.
apply
(
undefined
);
callTest3
.
apply
(
null
);
tmp
=
Number
.
prototype
.
toString
.
call
(
3
);
ok
(
tmp
===
"3"
,
"Number.prototype.toString.call(3) = "
+
tmp
);
...
...
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