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
46118045
Commit
46118045
authored
Sep 23, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 23, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added Object.toString for host objects implementation.
parent
37c2d43e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
object.c
dlls/jscript/object.c
+8
-3
api.js
dlls/jscript/tests/api.js
+2
-0
No files found.
dlls/jscript/object.c
View file @
46118045
...
@@ -36,6 +36,7 @@ static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D
...
@@ -36,6 +36,7 @@ static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
{
DispatchEx
*
jsdisp
;
DispatchEx
*
jsdisp
;
const
WCHAR
*
str
;
static
const
WCHAR
formatW
[]
=
{
'['
,
'o'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
' '
,
'%'
,
's'
,
']'
,
0
};
static
const
WCHAR
formatW
[]
=
{
'['
,
'o'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
' '
,
'%'
,
's'
,
']'
,
0
};
...
@@ -56,18 +57,22 @@ static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D
...
@@ -56,18 +57,22 @@ static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
jsdisp
=
get_jsdisp
(
jsthis
);
jsdisp
=
get_jsdisp
(
jsthis
);
if
(
!
jsdisp
||
names
[
jsdisp
->
builtin_info
->
class
]
==
NULL
)
{
if
(
!
jsdisp
)
{
str
=
objectW
;
}
else
if
(
names
[
jsdisp
->
builtin_info
->
class
])
{
str
=
names
[
jsdisp
->
builtin_info
->
class
];
}
else
{
FIXME
(
"jdisp->builtin_info->class = %d
\n
"
,
jsdisp
->
builtin_info
->
class
);
FIXME
(
"jdisp->builtin_info->class = %d
\n
"
,
jsdisp
->
builtin_info
->
class
);
return
E_FAIL
;
return
E_FAIL
;
}
}
if
(
retv
)
{
if
(
retv
)
{
V_VT
(
retv
)
=
VT_BSTR
;
V_VT
(
retv
)
=
VT_BSTR
;
V_BSTR
(
retv
)
=
SysAllocStringLen
(
NULL
,
9
+
strlenW
(
names
[
jsdisp
->
builtin_info
->
class
]
));
V_BSTR
(
retv
)
=
SysAllocStringLen
(
NULL
,
9
+
strlenW
(
str
));
if
(
!
V_BSTR
(
retv
))
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
sprintfW
(
V_BSTR
(
retv
),
formatW
,
names
[
jsdisp
->
builtin_info
->
class
]
);
sprintfW
(
V_BSTR
(
retv
),
formatW
,
str
);
}
}
return
S_OK
;
return
S_OK
;
...
...
dlls/jscript/tests/api.js
View file @
46118045
...
@@ -87,6 +87,8 @@ ok(tmp.f() === "[object Number]", "tmp.f() = " + tmp.f());
...
@@ -87,6 +87,8 @@ ok(tmp.f() === "[object Number]", "tmp.f() = " + tmp.f());
ok
(
tmp
.
f
()
===
"[object RegExp]"
,
"tmp.f() = "
+
tmp
.
f
());
ok
(
tmp
.
f
()
===
"[object RegExp]"
,
"tmp.f() = "
+
tmp
.
f
());
(
tmp
=
new
String
).
f
=
Object
.
prototype
.
toString
;
(
tmp
=
new
String
).
f
=
Object
.
prototype
.
toString
;
ok
(
tmp
.
f
()
===
"[object String]"
,
"tmp.f() = "
+
tmp
.
f
());
ok
(
tmp
.
f
()
===
"[object String]"
,
"tmp.f() = "
+
tmp
.
f
());
tmp
=
Object
.
prototype
.
toString
.
call
(
testObj
);
ok
(
tmp
===
"[object Object]"
,
"'' + new Object() = "
+
tmp
);
ok
(
Object
(
1
)
instanceof
Number
,
"Object(1) is not instance of Number"
);
ok
(
Object
(
1
)
instanceof
Number
,
"Object(1) is not instance of Number"
);
ok
(
Object
(
""
)
instanceof
String
,
"Object('') is not instance of String"
);
ok
(
Object
(
""
)
instanceof
String
,
"Object('') is not instance of String"
);
...
...
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