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
ebb46f3f
Commit
ebb46f3f
authored
Oct 19, 2010
by
Piotr Caban
Committed by
Alexandre Julliard
Oct 20, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added invocation flag tests.
parent
cac0620f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
126 additions
and
9 deletions
+126
-9
object.c
dlls/jscript/object.c
+4
-1
run.c
dlls/jscript/tests/run.c
+122
-8
No files found.
dlls/jscript/object.c
View file @
ebb46f3f
...
@@ -210,7 +210,10 @@ static HRESULT ObjectConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
...
@@ -210,7 +210,10 @@ static HRESULT ObjectConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
var_set_jsdisp
(
retv
,
obj
);
if
(
retv
)
var_set_jsdisp
(
retv
,
obj
);
else
jsdisp_release
(
obj
);
break
;
break
;
}
}
...
...
dlls/jscript/tests/run.c
View file @
ebb46f3f
...
@@ -70,6 +70,7 @@ DEFINE_EXPECT(testobj_prop_d);
...
@@ -70,6 +70,7 @@ DEFINE_EXPECT(testobj_prop_d);
DEFINE_EXPECT
(
testobj_noprop_d
);
DEFINE_EXPECT
(
testobj_noprop_d
);
DEFINE_EXPECT
(
GetItemInfo_testVal
);
DEFINE_EXPECT
(
GetItemInfo_testVal
);
DEFINE_EXPECT
(
ActiveScriptSite_OnScriptError
);
DEFINE_EXPECT
(
ActiveScriptSite_OnScriptError
);
DEFINE_EXPECT
(
invoke_func
);
#define DISPID_GLOBAL_TESTPROPGET 0x1000
#define DISPID_GLOBAL_TESTPROPGET 0x1000
#define DISPID_GLOBAL_TESTPROPPUT 0x1001
#define DISPID_GLOBAL_TESTPROPPUT 0x1001
...
@@ -83,7 +84,9 @@ DEFINE_EXPECT(ActiveScriptSite_OnScriptError);
...
@@ -83,7 +84,9 @@ DEFINE_EXPECT(ActiveScriptSite_OnScriptError);
#define DISPID_GLOBAL_TESTTHIS 0x1009
#define DISPID_GLOBAL_TESTTHIS 0x1009
#define DISPID_GLOBAL_TESTTHIS2 0x100a
#define DISPID_GLOBAL_TESTTHIS2 0x100a
#define DISPID_GLOBAL_INVOKEVERSION 0x100b
#define DISPID_GLOBAL_INVOKEVERSION 0x100b
#define DISPID_TEST_CREATEARRAY 0x100c
#define DISPID_GLOBAL_CREATEARRAY 0x100c
#define DISPID_GLOBAL_PROPGETFUNC 0x100d
#define DISPID_GLOBAL_OBJECT_FLAG 0x100e
#define DISPID_TESTOBJ_PROP 0x2000
#define DISPID_TESTOBJ_PROP 0x2000
...
@@ -236,18 +239,29 @@ static HRESULT WINAPI testObj_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
...
@@ -236,18 +239,29 @@ static HRESULT WINAPI testObj_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
{
{
switch
(
id
)
{
switch
(
id
)
{
case
DISPID_VALUE
:
case
DISPID_VALUE
:
CHECK_EXPECT
(
testobj_value
);
ok
(
wFlags
==
INVOKE_PROPERTYGET
,
"wFlags = %x
\n
"
,
wFlags
);
ok
(
pdp
!=
NULL
,
"pdp == NULL
\n
"
);
ok
(
pdp
!=
NULL
,
"pdp == NULL
\n
"
);
ok
(
!
pdp
->
rgvarg
,
"rgvarg != NULL
\n
"
);
ok
(
!
pdp
->
rgdispidNamedArgs
,
"rgdispidNamedArgs != NULL
\n
"
);
ok
(
!
pdp
->
rgdispidNamedArgs
,
"rgdispidNamedArgs != NULL
\n
"
);
ok
(
!
pdp
->
cArgs
,
"cArgs = %d
\n
"
,
pdp
->
cArgs
);
ok
(
!
pdp
->
cNamedArgs
,
"cNamedArgs = %d
\n
"
,
pdp
->
cNamedArgs
);
ok
(
!
pdp
->
cNamedArgs
,
"cNamedArgs = %d
\n
"
,
pdp
->
cNamedArgs
);
ok
(
pvarRes
!=
NULL
,
"pvarRes == NULL
\n
"
);
ok
(
pvarRes
!=
NULL
,
"pvarRes == NULL
\n
"
);
ok
(
V_VT
(
pvarRes
)
==
VT_EMPTY
,
"V_VT(pvarRes) = %d
\n
"
,
V_VT
(
pvarRes
));
ok
(
V_VT
(
pvarRes
)
==
VT_EMPTY
,
"V_VT(pvarRes) = %d
\n
"
,
V_VT
(
pvarRes
));
ok
(
pei
!=
NULL
,
"pei == NULL
\n
"
);
ok
(
pei
!=
NULL
,
"pei == NULL
\n
"
);
switch
(
wFlags
)
{
case
INVOKE_PROPERTYGET
:
CHECK_EXPECT
(
testobj_value
);
ok
(
!
pdp
->
rgvarg
,
"rgvarg != NULL
\n
"
);
ok
(
!
pdp
->
cArgs
,
"cArgs = %d
\n
"
,
pdp
->
cArgs
);
break
;
case
INVOKE_FUNC
:
ok
(
!
pdp
->
cArgs
,
"cArgs = %d
\n
"
,
pdp
->
cArgs
);
break
;
case
INVOKE_FUNC
|
INVOKE_PROPERTYGET
:
ok
(
pdp
->
cArgs
==
1
,
"cArgs = %d
\n
"
,
pdp
->
cArgs
);
break
;
default:
ok
(
0
,
"invalid flag (%x)
\n
"
,
wFlags
);
}
V_VT
(
pvarRes
)
=
VT_I4
;
V_VT
(
pvarRes
)
=
VT_I4
;
V_I4
(
pvarRes
)
=
1
;
V_I4
(
pvarRes
)
=
1
;
return
S_OK
;
return
S_OK
;
...
@@ -359,7 +373,17 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
...
@@ -359,7 +373,17 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
}
}
if
(
!
strcmp_wa
(
bstrName
,
"createArray"
))
{
if
(
!
strcmp_wa
(
bstrName
,
"createArray"
))
{
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
*
pid
=
DISPID_TEST_CREATEARRAY
;
*
pid
=
DISPID_GLOBAL_CREATEARRAY
;
return
S_OK
;
}
if
(
!
strcmp_wa
(
bstrName
,
"propGetFunc"
))
{
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
*
pid
=
DISPID_GLOBAL_PROPGETFUNC
;
return
S_OK
;
}
if
(
!
strcmp_wa
(
bstrName
,
"objectFlag"
))
{
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
*
pid
=
DISPID_GLOBAL_OBJECT_FLAG
;
return
S_OK
;
return
S_OK
;
}
}
...
@@ -579,7 +603,7 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
...
@@ -579,7 +603,7 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
return
S_OK
;
return
S_OK
;
case
DISPID_
TEST
_CREATEARRAY
:
{
case
DISPID_
GLOBAL
_CREATEARRAY
:
{
SAFEARRAYBOUND
bound
[
2
];
SAFEARRAYBOUND
bound
[
2
];
VARIANT
*
data
;
VARIANT
*
data
;
int
i
,
j
;
int
i
,
j
;
...
@@ -614,6 +638,78 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
...
@@ -614,6 +638,78 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
return
S_OK
;
return
S_OK
;
}
}
case
DISPID_GLOBAL_PROPGETFUNC
:
switch
(
wFlags
)
{
case
INVOKE_FUNC
:
CHECK_EXPECT
(
invoke_func
);
break
;
case
INVOKE_FUNC
|
INVOKE_PROPERTYGET
:
ok
(
pdp
->
cArgs
!=
0
,
"pdp->cArgs = %d
\n
"
,
pdp
->
cArgs
);
ok
(
pvarRes
!=
NULL
,
"pdp->pvarRes == NULL
\n
"
);
break
;
default:
ok
(
0
,
"invalid flag (%x)
\n
"
,
wFlags
);
}
ok
(
pdp
!=
NULL
,
"pdp == NULL
\n
"
);
ok
(
!
pdp
->
rgdispidNamedArgs
,
"rgdispidNamedArgs != NULL
\n
"
);
ok
(
!
pdp
->
cNamedArgs
,
"cNamedArgs = %d
\n
"
,
pdp
->
cNamedArgs
);
ok
(
pei
!=
NULL
,
"pei == NULL
\n
"
);
if
(
pvarRes
)
{
ok
(
V_VT
(
pvarRes
)
==
VT_EMPTY
,
"V_VT(pvarRes) = %d
\n
"
,
V_VT
(
pvarRes
));
V_VT
(
pvarRes
)
=
VT_I4
;
V_I4
(
pvarRes
)
=
pdp
->
cArgs
;
}
return
S_OK
;
case
DISPID_GLOBAL_OBJECT_FLAG
:
{
IDispatchEx
*
dispex
;
BSTR
str
;
HRESULT
hres
;
hres
=
IDispatch_QueryInterface
(
script_disp
,
&
IID_IDispatchEx
,
(
void
**
)
&
dispex
);
ok
(
hres
==
S_OK
,
"hres = %x
\n
"
,
hres
);
str
=
a2bstr
(
"Object"
);
hres
=
IDispatchEx_GetDispID
(
dispex
,
str
,
fdexNameCaseSensitive
,
&
id
);
SysFreeString
(
str
);
ok
(
hres
==
S_OK
,
"hres = %x
\n
"
,
hres
);
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
lcid
,
DISPATCH_METHOD
,
pdp
,
NULL
,
pei
,
pspCaller
);
ok
(
hres
==
S_OK
,
"hres = %x
\n
"
,
hres
);
V_VT
(
pvarRes
)
=
VT_EMPTY
;
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
lcid
,
DISPATCH_METHOD
,
pdp
,
pvarRes
,
pei
,
pspCaller
);
ok
(
hres
==
S_OK
,
"hres = %x
\n
"
,
hres
);
ok
(
V_VT
(
pvarRes
)
==
VT_DISPATCH
,
"V_VT(pvarRes) = %d
\n
"
,
V_VT
(
pvarRes
));
VariantClear
(
pvarRes
);
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
lcid
,
DISPATCH_METHOD
|
DISPATCH_PROPERTYGET
,
pdp
,
NULL
,
pei
,
pspCaller
);
ok
(
hres
==
S_OK
,
"hres = %x
\n
"
,
hres
);
V_VT
(
pvarRes
)
=
VT_EMPTY
;
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
lcid
,
DISPATCH_CONSTRUCT
,
pdp
,
pvarRes
,
pei
,
pspCaller
);
ok
(
hres
==
S_OK
,
"hres = %x
\n
"
,
hres
);
ok
(
V_VT
(
pvarRes
)
==
VT_DISPATCH
,
"V_VT(pvarRes) = %d
\n
"
,
V_VT
(
pvarRes
));
VariantClear
(
pvarRes
);
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
lcid
,
DISPATCH_CONSTRUCT
,
pdp
,
NULL
,
pei
,
pspCaller
);
ok
(
hres
==
S_OK
,
"hres = %x
\n
"
,
hres
);
V_VT
(
pvarRes
)
=
VT_EMPTY
;
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
lcid
,
DISPATCH_CONSTRUCT
|
DISPATCH_PROPERTYGET
,
pdp
,
pvarRes
,
pei
,
pspCaller
);
ok
(
hres
==
E_INVALIDARG
,
"hres = %x
\n
"
,
hres
);
V_VT
(
pvarRes
)
=
VT_EMPTY
;
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
lcid
,
wFlags
,
pdp
,
pvarRes
,
pei
,
pspCaller
);
ok
(
hres
==
S_OK
,
"hres = %x
\n
"
,
hres
);
ok
(
V_VT
(
pvarRes
)
==
VT_DISPATCH
,
"V_VT(pvarRes) = %d
\n
"
,
V_VT
(
pvarRes
));
IDispatchEx_Release
(
dispex
);
return
S_OK
;
}
}
}
ok
(
0
,
"unexpected call %x
\n
"
,
id
);
ok
(
0
,
"unexpected call %x
\n
"
,
id
);
...
@@ -1270,6 +1366,24 @@ static void run_tests(void)
...
@@ -1270,6 +1366,24 @@ static void run_tests(void)
parse_script_a
(
"(function () { var testPropGet; })();"
);
parse_script_a
(
"(function () { var testPropGet; })();"
);
parse_script_a
(
"(function () { eval('var testPropGet;'); })();"
);
parse_script_a
(
"(function () { eval('var testPropGet;'); })();"
);
SET_EXPECT
(
invoke_func
);
parse_script_a
(
"ok(propGetFunc() == 0,
\"
Incorrect propGetFunc value
\"
);"
);
CHECK_CALLED
(
invoke_func
);
parse_script_a
(
"ok(propGetFunc(1) == 1,
\"
Incorrect propGetFunc value
\"
);"
);
parse_script_a
(
"ok(propGetFunc(1, 2) == 2,
\"
Incorrect propGetFunc value
\"
);"
);
SET_EXPECT
(
invoke_func
);
parse_script_a
(
"ok(propGetFunc().toString() == 0,
\"
Incorrect propGetFunc value
\"
);"
);
CHECK_CALLED
(
invoke_func
);
parse_script_a
(
"ok(propGetFunc(1).toString() == 1,
\"
Incorrect propGetFunc value
\"
);"
);
SET_EXPECT
(
invoke_func
);
parse_script_a
(
"propGetFunc(1);"
);
CHECK_CALLED
(
invoke_func
);
parse_script_a
(
"objectFlag(1).toString();"
);
parse_script_a
(
"(function() { var tmp = (function () { return testObj; })()(1);})();"
);
parse_script_a
(
"(function() { var tmp = (function () { return testObj; })()();})();"
);
parse_script_a
(
"ok((testObj instanceof Object) === false, 'testObj is instance of Object');"
);
parse_script_a
(
"ok((testObj instanceof Object) === false, 'testObj is instance of Object');"
);
SET_EXPECT
(
testobj_prop_d
);
SET_EXPECT
(
testobj_prop_d
);
...
...
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