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
3d1595dc
Commit
3d1595dc
authored
Dec 29, 2010
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 29, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Return 'unknown' in typeof operator for native object's values that can't be retrieved.
parent
48202ee0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
3 deletions
+41
-3
engine.c
dlls/jscript/engine.c
+7
-1
lang.js
dlls/jscript/tests/lang.js
+5
-2
run.c
dlls/jscript/tests/run.c
+29
-0
No files found.
dlls/jscript/engine.c
View file @
3d1595dc
...
...
@@ -2365,6 +2365,7 @@ static HRESULT typeof_exprval(script_ctx_t *ctx, exprval_t *exprval, jsexcept_t
static
const
WCHAR
objectW
[]
=
{
'o'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
0
};
static
const
WCHAR
stringW
[]
=
{
's'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
static
const
WCHAR
undefinedW
[]
=
{
'u'
,
'n'
,
'd'
,
'e'
,
'f'
,
'i'
,
'n'
,
'e'
,
'd'
,
0
};
static
const
WCHAR
unknownW
[]
=
{
'u'
,
'n'
,
'k'
,
'n'
,
'o'
,
'w'
,
'n'
,
0
};
if
(
exprval
->
type
==
EXPRVAL_INVALID
)
{
*
ret
=
undefinedW
;
...
...
@@ -2372,8 +2373,13 @@ static HRESULT typeof_exprval(script_ctx_t *ctx, exprval_t *exprval, jsexcept_t
}
hres
=
exprval_to_value
(
ctx
,
exprval
,
ei
,
&
val
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
{
if
(
exprval
->
type
==
EXPRVAL_IDREF
)
{
*
ret
=
unknownW
;
return
S_OK
;
}
return
hres
;
}
switch
(
V_VT
(
&
val
))
{
case
VT_EMPTY
:
...
...
dlls/jscript/tests/lang.js
View file @
3d1595dc
...
...
@@ -108,6 +108,11 @@ ok(typeof(testFunc1) === "function", "typeof(testFunc1) is not function");
ok
(
typeof
(
String
)
===
"function"
,
"typeof(String) is not function"
);
ok
(
typeof
(
ScriptEngine
)
===
"function"
,
"typeof(ScriptEngine) is not function"
);
ok
(
typeof
(
this
)
===
"object"
,
"typeof(this) is not object"
);
ok
(
typeof
(
doesnotexist
)
===
"undefined"
,
"typeof(doesnotexist) = "
+
typeof
(
doesnotexist
));
tmp
=
typeof
((
new
Object
()).
doesnotexist
);
ok
(
tmp
===
"undefined"
,
"typeof((new Object).doesnotexist = "
+
tmp
);
tmp
=
typeof
(
testObj
.
onlyDispID
);
ok
(
tmp
===
"unknown"
,
"typeof(testObj.onlyDispID) = "
+
tmp
);
ok
(
testFunc1
(
true
,
"test"
)
===
true
,
"testFunc1 not returned true"
);
...
...
@@ -1057,8 +1062,6 @@ if(false) {
ok(in_if_false(), "
in_if_false
failed
");
ok(typeof(doesnotexist) === "
undefined
", "
typeof
(
doesnotexist
)
=
" + typeof(doesnotexist));
(function() { newValue = 1; })();
ok(newValue === 1, "
newValue
=
" + newValue);
...
...
dlls/jscript/tests/run.c
View file @
3d1595dc
...
...
@@ -68,6 +68,8 @@ DEFINE_EXPECT(testobj_delete);
DEFINE_EXPECT
(
testobj_value
);
DEFINE_EXPECT
(
testobj_prop_d
);
DEFINE_EXPECT
(
testobj_noprop_d
);
DEFINE_EXPECT
(
testobj_onlydispid_d
);
DEFINE_EXPECT
(
testobj_onlydispid_i
);
DEFINE_EXPECT
(
GetItemInfo_testVal
);
DEFINE_EXPECT
(
ActiveScriptSite_OnScriptError
);
DEFINE_EXPECT
(
invoke_func
);
...
...
@@ -90,6 +92,7 @@ DEFINE_EXPECT(invoke_func);
#define DISPID_GLOBAL_ISWIN64 0x100f
#define DISPID_TESTOBJ_PROP 0x2000
#define DISPID_TESTOBJ_ONLYDISPID 0x2001
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
static
const
CHAR
testA
[]
=
"test"
;
...
...
@@ -230,6 +233,13 @@ static HRESULT WINAPI testObj_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
return
DISP_E_UNKNOWNNAME
;
}
if
(
!
strcmp_wa
(
bstrName
,
"onlyDispID"
))
{
if
(
strict_dispid_check
)
CHECK_EXPECT
(
testobj_onlydispid_d
);
test_grfdex
(
grfdex
,
fdexNameCaseSensitive
);
*
pid
=
DISPID_TESTOBJ_ONLYDISPID
;
return
S_OK
;
}
ok
(
0
,
"unexpected name %s
\n
"
,
wine_dbgstr_w
(
bstrName
));
return
E_NOTIMPL
;
...
...
@@ -266,6 +276,19 @@ static HRESULT WINAPI testObj_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
V_VT
(
pvarRes
)
=
VT_I4
;
V_I4
(
pvarRes
)
=
1
;
return
S_OK
;
case
DISPID_TESTOBJ_ONLYDISPID
:
if
(
strict_dispid_check
)
CHECK_EXPECT
(
testobj_onlydispid_i
);
ok
(
wFlags
==
INVOKE_PROPERTYGET
,
"wFlags = %x
\n
"
,
wFlags
);
ok
(
pdp
!=
NULL
,
"pdp == NULL
\n
"
);
ok
(
!
pdp
->
rgvarg
,
"rgvarg != 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
(
pvarRes
!=
NULL
,
"pvarRes == NULL
\n
"
);
ok
(
V_VT
(
pvarRes
)
==
VT_EMPTY
,
"V_VT(pvarRes) = %d
\n
"
,
V_VT
(
pvarRes
));
ok
(
pei
!=
NULL
,
"pei == NULL
\n
"
);
return
DISP_E_MEMBERNOTFOUND
;
}
ok
(
0
,
"unexpected call %x
\n
"
,
id
);
...
...
@@ -1431,6 +1454,12 @@ static void run_tests(void)
parse_script_a
(
"testThis(this);"
);
parse_script_a
(
"(function () { testThis(this); })();"
);
SET_EXPECT
(
testobj_onlydispid_d
);
SET_EXPECT
(
testobj_onlydispid_i
);
parse_script_a
(
"ok(typeof(testObj.onlyDispID) === 'unknown', 'unexpected typeof(testObj.onlyDispID)');"
);
CHECK_CALLED
(
testobj_onlydispid_d
);
CHECK_CALLED
(
testobj_onlydispid_i
);
run_from_res
(
"lang.js"
);
run_from_res
(
"api.js"
);
run_from_res
(
"regexp.js"
);
...
...
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