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
8761462b
Commit
8761462b
authored
Aug 29, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added Function.call implementation.
parent
662efe83
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
3 deletions
+88
-3
function.c
dlls/jscript/function.c
+60
-3
api.js
dlls/jscript/tests/api.js
+28
-0
No files found.
dlls/jscript/function.c
View file @
8761462b
...
...
@@ -254,6 +254,34 @@ static HRESULT invoke_value_proc(FunctionInstance *function, LCID lcid, WORD fla
return
hres
;
}
static
HRESULT
call_function
(
FunctionInstance
*
function
,
IDispatch
*
this_obj
,
LCID
lcid
,
DISPPARAMS
*
args
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
{
HRESULT
hres
;
if
(
function
->
value_proc
)
{
DispatchEx
*
jsthis
=
NULL
;
if
(
this_obj
)
{
jsthis
=
iface_to_jsdisp
((
IUnknown
*
)
this_obj
);
if
(
!
jsthis
)
FIXME
(
"this_obj is not DispatchEx
\n
"
);
}
hres
=
function
->
value_proc
(
jsthis
?
jsthis
:
function
->
dispex
.
ctx
->
script_disp
,
lcid
,
DISPATCH_METHOD
,
args
,
retv
,
ei
,
caller
);
if
(
jsthis
)
jsdisp_release
(
jsthis
);
}
else
{
hres
=
invoke_source
(
function
,
this_obj
?
this_obj
:
(
IDispatch
*
)
_IDispatchEx_
(
function
->
dispex
.
ctx
->
script_disp
),
lcid
,
args
,
retv
,
ei
,
caller
);
}
return
hres
;
}
static
HRESULT
function_to_string
(
FunctionInstance
*
function
,
BSTR
*
ret
)
{
BSTR
str
;
...
...
@@ -326,10 +354,39 @@ static HRESULT Function_apply(DispatchEx *dispex, LCID lcid, WORD flags, DISPPAR
}
static
HRESULT
Function_call
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
FunctionInstance
*
function
;
DISPPARAMS
args
=
{
NULL
,
NULL
,
0
,
0
};
IDispatch
*
this_obj
=
NULL
;
DWORD
argc
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
if
(
!
is_class
(
dispex
,
JSCLASS_FUNCTION
))
{
FIXME
(
"dispex is not a function
\n
"
);
return
E_FAIL
;
}
function
=
(
FunctionInstance
*
)
dispex
;
argc
=
arg_cnt
(
dp
);
if
(
argc
)
{
hres
=
to_object
(
dispex
->
ctx
,
get_arg
(
dp
,
0
),
&
this_obj
);
if
(
FAILED
(
hres
))
return
hres
;
args
.
cArgs
=
argc
-
1
;
}
if
(
args
.
cArgs
)
args
.
rgvarg
=
dp
->
rgvarg
+
dp
->
cArgs
-
args
.
cArgs
-
1
;
hres
=
call_function
(
function
,
this_obj
,
lcid
,
&
args
,
retv
,
ei
,
caller
);
if
(
this_obj
)
IDispatch_Release
(
this_obj
);
return
hres
;
}
HRESULT
Function_value
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
...
...
dlls/jscript/tests/api.js
View file @
8761462b
...
...
@@ -1125,6 +1125,34 @@ ok(testFuncToString.toString() === "function testFuncToString(x,y) {\n return
ok
(
""
+
testFuncToString
===
"function testFuncToString(x,y) {
\
n return x+y;
\
n}"
,
"'' + testFuncToString = "
+
testFuncToString
);
tmp
=
new
Object
();
function
callTest
(
argc
)
{
ok
(
this
===
tmp
,
"this !== tmp
\
n"
);
ok
(
arguments
.
length
===
argc
+
1
,
"arguments.length = "
+
arguments
.
length
+
" expected "
+
(
argc
+
1
));
for
(
var
i
=
1
;
i
<=
argc
;
i
++
)
ok
(
arguments
[
i
]
===
i
,
"arguments[i] = "
+
arguments
[
i
]);
}
callTest
.
call
(
tmp
,
1
,
1
);
callTest
.
call
(
tmp
,
2
,
1
,
2
);
function
callTest2
()
{
ok
(
this
===
tmp
,
"this !== tmp
\
n"
);
ok
(
arguments
.
length
===
0
,
"callTest2: arguments.length = "
+
arguments
.
length
+
" expected 0"
);
}
callTest2
.
call
(
tmp
);
function
callTest3
()
{
ok
(
arguments
.
length
===
0
,
"arguments.length = "
+
arguments
.
length
+
" expected 0"
);
}
callTest3
.
call
();
tmp
=
Number
.
prototype
.
toString
.
call
(
3
);
ok
(
tmp
===
"3"
,
"Number.prototype.toString.call(3) = "
+
tmp
);
var
date
=
new
Date
();
date
=
new
Date
(
100
);
...
...
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