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
db6b86cb
Commit
db6b86cb
authored
Jun 15, 2016
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 17, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Allow Function.apply() to be called on non-jscript objects.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
92300cc4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
7 deletions
+34
-7
function.c
dlls/jscript/function.c
+15
-3
run.c
dlls/jscript/tests/run.c
+19
-4
No files found.
dlls/jscript/function.c
View file @
db6b86cb
...
...
@@ -426,7 +426,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
TRACE
(
"
\n
"
);
if
(
!
(
function
=
function_this
(
jsthis
)))
if
(
!
(
function
=
function_this
(
jsthis
))
&&
(
jsthis
->
flags
&
VDISP_JSDISP
)
)
return
throw_type_error
(
ctx
,
JS_E_FUNCTION_EXPECTED
,
NULL
);
if
(
argc
)
{
...
...
@@ -458,8 +458,20 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
}
}
if
(
SUCCEEDED
(
hres
))
hres
=
call_function
(
ctx
,
function
,
this_obj
,
cnt
,
args
,
(
flags
&
DISPATCH_JSCRIPT_CALLEREXECSSOURCE
)
!=
0
,
r
);
if
(
SUCCEEDED
(
hres
))
{
if
(
function
)
{
hres
=
call_function
(
ctx
,
function
,
this_obj
,
cnt
,
args
,
(
flags
&
DISPATCH_JSCRIPT_CALLEREXECSSOURCE
)
!=
0
,
r
);
}
else
{
jsval_t
res
;
hres
=
disp_call_value
(
ctx
,
jsthis
->
u
.
disp
,
this_obj
,
DISPATCH_METHOD
,
cnt
,
args
,
&
res
);
if
(
SUCCEEDED
(
hres
))
{
if
(
r
)
*
r
=
res
;
else
jsval_release
(
res
);
}
}
}
if
(
this_obj
)
IDispatch_Release
(
this_obj
);
...
...
dlls/jscript/tests/run.c
View file @
db6b86cb
...
...
@@ -483,11 +483,15 @@ static HRESULT WINAPI dispexFunc_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
ok
(
pdp
->
cArgs
==
2
,
"cArgs = %d
\n
"
,
pdp
->
cArgs
);
ok
(
pdp
->
cNamedArgs
==
1
,
"cNamedArgs = %d
\n
"
,
pdp
->
cNamedArgs
);
ok
(
res
!=
NULL
,
"res == NULL
\n
"
);
ok
(
wFlags
==
(
DISPATCH_PROPERTYGET
|
DISPATCH_METHOD
),
"wFlags = %x
\n
"
,
wFlags
);
ok
(
pei
!=
NULL
,
"pei == NULL
\n
"
);
ok
(
V_VT
(
pdp
->
rgvarg
+
1
)
==
VT_BOOL
,
"V_VT(pdp->rgvarg+1) = %d
\n
"
,
V_VT
(
pdp
->
rgvarg
+
1
));
ok
(
!
V_BOOL
(
pdp
->
rgvarg
+
1
),
"V_BOOL(pdp->rgvarg+1) = %x
\n
"
,
V_BOOL
(
pdp
->
rgvarg
+
1
));
if
(
V_BOOL
(
pdp
->
rgvarg
+
1
))
/* NOTE: If called by Function.apply(), native doesn't set DISPATCH_PROPERTYGET flag. */
todo_wine
ok
(
wFlags
==
DISPATCH_METHOD
,
"wFlags = %x
\n
"
,
wFlags
);
else
ok
(
wFlags
==
(
DISPATCH_PROPERTYGET
|
DISPATCH_METHOD
),
"wFlags = %x
\n
"
,
wFlags
);
ok
(
V_VT
(
pdp
->
rgvarg
)
==
VT_DISPATCH
,
"V_VT(pdp->rgvarg) = %d
\n
"
,
V_VT
(
pdp
->
rgvarg
));
ok
(
V_DISPATCH
(
pdp
->
rgvarg
)
!=
NULL
,
"V_DISPATCH(pdp->rgvarg) == NULL
\n
"
);
...
...
@@ -567,12 +571,15 @@ static HRESULT WINAPI pureDisp_Invoke(IDispatchEx *iface, DISPID dispIdMember, R
ok
(
pdp
->
cArgs
==
1
,
"cArgs = %d
\n
"
,
pdp
->
cArgs
);
ok
(
!
pdp
->
cNamedArgs
,
"cNamedArgs = %d
\n
"
,
pdp
->
cNamedArgs
);
ok
(
res
!=
NULL
,
"res == NULL
\n
"
);
ok
(
wFlags
==
(
DISPATCH_PROPERTYGET
|
DISPATCH_METHOD
),
"wFlags = %x
\n
"
,
wFlags
);
ok
(
ei
!=
NULL
,
"ei == NULL
\n
"
);
ok
(
puArgErr
!=
NULL
,
"puArgErr == NULL
\n
"
);
ok
(
V_VT
(
pdp
->
rgvarg
)
==
VT_BOOL
,
"V_VT(pdp->rgvarg) = %d
\n
"
,
V_VT
(
pdp
->
rgvarg
));
ok
(
!
V_BOOL
(
pdp
->
rgvarg
),
"V_BOOL(pdp->rgvarg) = %x
\n
"
,
V_BOOL
(
pdp
->
rgvarg
));
if
(
V_BOOL
(
pdp
->
rgvarg
))
todo_wine
ok
(
wFlags
==
DISPATCH_METHOD
,
"wFlags = %x
\n
"
,
wFlags
);
else
ok
(
wFlags
==
(
DISPATCH_PROPERTYGET
|
DISPATCH_METHOD
),
"wFlags = %x
\n
"
,
wFlags
);
if
(
res
)
V_VT
(
res
)
=
VT_NULL
;
...
...
@@ -2501,6 +2508,14 @@ static BOOL run_tests(void)
parse_script_a
(
"var t = {func: dispexFunc}; t = t.func(false);"
);
CHECK_CALLED
(
dispexfunc_value
);
SET_EXPECT
(
dispexfunc_value
);
parse_script_a
(
"Function.prototype.apply.call(dispexFunc, testObj, [true]);"
);
CHECK_CALLED
(
dispexfunc_value
);
SET_EXPECT
(
puredisp_value
);
parse_script_a
(
"Function.prototype.apply.call(pureDisp, testObj, [true]);"
);
CHECK_CALLED
(
puredisp_value
);
parse_script_a
(
"(function reportSuccess() {})()"
);
parse_script_a
(
"ok(typeof(test) === 'object',
\"
typeof(test) != 'object'
\"
);"
);
...
...
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