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
9d4e93cf
Commit
9d4e93cf
authored
Nov 22, 2022
by
Gabriel Ivăncescu
Committed by
Alexandre Julliard
Nov 23, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Pass a jsval as the 'this' to jsdisp_call_value.
Signed-off-by:
Gabriel Ivăncescu
<
gabrielopcode@gmail.com
>
parent
3805eef4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
20 deletions
+17
-20
array.c
dlls/jscript/array.c
+1
-1
dispex.c
dlls/jscript/dispex.c
+10
-8
function.c
dlls/jscript/function.c
+2
-7
jscript.h
dlls/jscript/jscript.h
+2
-2
json.c
dlls/jscript/json.c
+1
-1
string.c
dlls/jscript/string.c
+1
-1
No files found.
dlls/jscript/array.c
View file @
9d4e93cf
...
...
@@ -631,7 +631,7 @@ static HRESULT sort_cmp(script_ctx_t *ctx, jsdisp_t *cmp_func, jsval_t v1, jsval
jsval_t
res
;
double
n
;
hres
=
jsdisp_call_value
(
cmp_func
,
NULL
,
DISPATCH_METHOD
,
2
,
args
,
&
res
);
hres
=
jsdisp_call_value
(
cmp_func
,
jsval_undefined
()
,
DISPATCH_METHOD
,
2
,
args
,
&
res
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/dispex.c
View file @
9d4e93cf
...
...
@@ -462,7 +462,7 @@ static HRESULT prop_get(jsdisp_t *This, dispex_prop_t *prop, jsval_t *r)
break
;
case
PROP_ACCESSOR
:
if
(
prop
->
u
.
accessor
.
getter
)
{
hres
=
jsdisp_call_value
(
prop
->
u
.
accessor
.
getter
,
to_disp
(
This
),
hres
=
jsdisp_call_value
(
prop
->
u
.
accessor
.
getter
,
jsval_obj
(
This
),
DISPATCH_METHOD
,
0
,
NULL
,
r
);
}
else
{
*
r
=
jsval_undefined
();
...
...
@@ -529,7 +529,7 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val)
TRACE
(
"no setter
\n
"
);
return
S_OK
;
}
return
jsdisp_call_value
(
prop
->
u
.
accessor
.
setter
,
to_disp
(
This
),
DISPATCH_METHOD
,
1
,
&
val
,
NULL
);
return
jsdisp_call_value
(
prop
->
u
.
accessor
.
setter
,
jsval_obj
(
This
),
DISPATCH_METHOD
,
1
,
&
val
,
NULL
);
case
PROP_IDX
:
if
(
!
This
->
builtin_info
->
idx_put
)
{
TRACE
(
"no put_idx
\n
"
);
...
...
@@ -1602,16 +1602,18 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
case
DISPATCH_METHOD
:
case
DISPATCH_CONSTRUCT
:
{
jsval_t
*
argv
,
buf
[
6
],
r
;
IDispatch
*
passed_this
;
unsigned
argc
;
hres
=
convert_params
(
This
->
ctx
,
pdp
,
buf
,
&
argc
,
&
argv
);
if
(
FAILED
(
hres
))
break
;
passed_this
=
get_this
(
pdp
);
if
(
prop
)
hres
=
invoke_prop_func
(
This
,
get_this
(
pdp
)
,
prop
,
wFlags
,
argc
,
argv
,
pvarRes
?
&
r
:
NULL
,
pspCaller
);
hres
=
invoke_prop_func
(
This
,
passed_this
,
prop
,
wFlags
,
argc
,
argv
,
pvarRes
?
&
r
:
NULL
,
pspCaller
);
else
hres
=
jsdisp_call_value
(
This
,
get_this
(
pdp
),
wFlags
,
argc
,
argv
,
pvarRes
?
&
r
:
NULL
);
hres
=
jsdisp_call_value
(
This
,
passed_this
?
jsval_disp
(
passed_this
)
:
jsval_undefined
(
),
wFlags
,
argc
,
argv
,
pvarRes
?
&
r
:
NULL
);
if
(
argv
!=
buf
)
free
(
argv
);
...
...
@@ -1991,14 +1993,14 @@ HRESULT jsdisp_get_id(jsdisp_t *jsdisp, const WCHAR *name, DWORD flags, DISPID *
return
DISP_E_UNKNOWNNAME
;
}
HRESULT
jsdisp_call_value
(
jsdisp_t
*
jsfunc
,
IDispatch
*
js
this
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
HRESULT
jsdisp_call_value
(
jsdisp_t
*
jsfunc
,
jsval_t
v
this
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
HRESULT
hres
;
assert
(
!
(
flags
&
~
(
DISPATCH_METHOD
|
DISPATCH_CONSTRUCT
|
DISPATCH_JSCRIPT_INTERNAL_MASK
)));
if
(
is_class
(
jsfunc
,
JSCLASS_FUNCTION
))
{
hres
=
Function_invoke
(
jsfunc
,
js
this
,
flags
,
argc
,
argv
,
r
);
hres
=
Function_invoke
(
jsfunc
,
v
this
,
flags
,
argc
,
argv
,
r
);
}
else
{
if
(
!
jsfunc
->
builtin_info
->
call
)
{
WARN
(
"Not a function
\n
"
);
...
...
@@ -2009,7 +2011,7 @@ HRESULT jsdisp_call_value(jsdisp_t *jsfunc, IDispatch *jsthis, WORD flags, unsig
return
E_UNEXPECTED
;
flags
&=
~
DISPATCH_JSCRIPT_INTERNAL_MASK
;
hres
=
jsfunc
->
builtin_info
->
call
(
jsfunc
->
ctx
,
jsthis
?
jsval_disp
(
jsthis
)
:
jsval_null
()
,
flags
,
argc
,
argv
,
r
);
hres
=
jsfunc
->
builtin_info
->
call
(
jsfunc
->
ctx
,
vthis
,
flags
,
argc
,
argv
,
r
);
}
return
hres
;
}
...
...
@@ -2202,7 +2204,7 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
jsdisp
=
iface_to_jsdisp
(
disp
);
if
(
jsdisp
&&
jsdisp
->
ctx
==
ctx
)
{
hres
=
jsdisp_call_value
(
jsdisp
,
jsthis
,
flags
,
argc
,
argv
,
r
);
hres
=
jsdisp_call_value
(
jsdisp
,
jsthis
?
jsval_disp
(
jsthis
)
:
jsval_undefined
()
,
flags
,
argc
,
argv
,
r
);
jsdisp_release
(
jsdisp
);
return
hres
;
}
...
...
dlls/jscript/function.c
View file @
9d4e93cf
...
...
@@ -247,12 +247,11 @@ void detach_arguments_object(jsdisp_t *args_disp)
jsdisp_release
(
frame
->
arguments_obj
);
}
HRESULT
Function_invoke
(
jsdisp_t
*
func_this
,
IDispatch
*
js
this
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
HRESULT
Function_invoke
(
jsdisp_t
*
func_this
,
jsval_t
v
this
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FunctionInstance
*
function
;
jsval_t
vthis
;
TRACE
(
"func %p this %
p
\n
"
,
func_this
,
jsthis
);
TRACE
(
"func %p this %
s
\n
"
,
func_this
,
debugstr_jsval
(
vthis
)
);
assert
(
is_class
(
func_this
,
JSCLASS_FUNCTION
));
function
=
function_from_jsdisp
(
func_this
);
...
...
@@ -262,10 +261,6 @@ HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, unsi
return
E_UNEXPECTED
;
}
if
(
jsthis
)
vthis
=
jsval_disp
(
jsthis
);
else
vthis
=
function
->
dispex
.
ctx
->
version
<
SCRIPTLANGUAGEVERSION_ES5
?
jsval_null
()
:
jsval_undefined
();
return
function
->
vtbl
->
call
(
function
->
dispex
.
ctx
,
function
,
vthis
,
flags
,
argc
,
argv
,
r
);
}
...
...
dlls/jscript/jscript.h
View file @
9d4e93cf
...
...
@@ -226,7 +226,7 @@ HRESULT init_dispex_from_constr(jsdisp_t*,script_ctx_t*,const builtin_info_t*,js
HRESULT
disp_call
(
script_ctx_t
*
,
IDispatch
*
,
DISPID
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_call_name
(
script_ctx_t
*
,
IDispatch
*
,
const
WCHAR
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_call_value
(
script_ctx_t
*
,
IDispatch
*
,
IDispatch
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_call_value
(
jsdisp_t
*
,
IDispatch
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_call_value
(
jsdisp_t
*
,
jsval_t
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_call
(
jsdisp_t
*
,
DISPID
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_call_name
(
jsdisp_t
*
,
const
WCHAR
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
disp_propget
(
script_ctx_t
*
,
IDispatch
*
,
DISPID
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
...
...
@@ -255,7 +255,7 @@ HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const WCHAR*,cons
jsdisp_t
*
,
jsdisp_t
**
)
DECLSPEC_HIDDEN
;
HRESULT
create_builtin_constructor
(
script_ctx_t
*
,
builtin_invoke_t
,
const
WCHAR
*
,
const
builtin_info_t
*
,
DWORD
,
jsdisp_t
*
,
jsdisp_t
**
)
DECLSPEC_HIDDEN
;
HRESULT
Function_invoke
(
jsdisp_t
*
,
IDispatch
*
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
Function_invoke
(
jsdisp_t
*
,
jsval_t
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
Function_value
(
script_ctx_t
*
,
jsval_t
,
WORD
,
unsigned
,
jsval_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
Function_get_value
(
script_ctx_t
*
,
jsdisp_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
...
...
dlls/jscript/json.c
View file @
9d4e93cf
...
...
@@ -775,7 +775,7 @@ static HRESULT stringify(stringify_ctx_t *ctx, jsdisp_t *object, const WCHAR *na
}
args
[
0
]
=
jsval_string
(
name_str
);
args
[
1
]
=
value
;
hres
=
jsdisp_call_value
(
ctx
->
replacer
,
to_disp
(
object
),
DISPATCH_METHOD
,
ARRAY_SIZE
(
args
),
args
,
&
v
);
hres
=
jsdisp_call_value
(
ctx
->
replacer
,
jsval_obj
(
object
),
DISPATCH_METHOD
,
ARRAY_SIZE
(
args
),
args
,
&
v
);
jsstr_release
(
name_str
);
jsval_release
(
value
);
if
(
FAILED
(
hres
))
...
...
dlls/jscript/string.c
View file @
9d4e93cf
...
...
@@ -702,7 +702,7 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func,
}
if
(
SUCCEEDED
(
hres
))
hres
=
jsdisp_call_value
(
func
,
NULL
,
DISPATCH_METHOD
,
argc
,
argv
,
&
val
);
hres
=
jsdisp_call_value
(
func
,
jsval_undefined
()
,
DISPATCH_METHOD
,
argc
,
argv
,
&
val
);
for
(
i
=
0
;
i
<=
match
->
paren_count
;
i
++
)
jsstr_release
(
get_string
(
argv
[
i
]));
...
...
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