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
f5e678e8
Commit
f5e678e8
authored
Jul 16, 2009
by
Piotr Caban
Committed by
Alexandre Julliard
Jul 16, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Improve Object_toString implementation.
parent
889d20f8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
1 deletion
+42
-1
jscript.h
dlls/jscript/jscript.h
+1
-0
object.c
dlls/jscript/object.c
+25
-1
api.js
dlls/jscript/tests/api.js
+16
-0
No files found.
dlls/jscript/jscript.h
View file @
f5e678e8
...
...
@@ -68,6 +68,7 @@ typedef enum {
JSCLASS_ARRAY
,
JSCLASS_BOOLEAN
,
JSCLASS_DATE
,
JSCLASS_ERROR
,
JSCLASS_FUNCTION
,
JSCLASS_GLOBAL
,
JSCLASS_MATH
,
...
...
dlls/jscript/object.c
View file @
f5e678e8
...
...
@@ -35,13 +35,37 @@ static const WCHAR default_valueW[] = {'[','o','b','j','e','c','t',' ','O','b','
static
HRESULT
Object_toString
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
static
const
WCHAR
formatW
[]
=
{
'['
,
'o'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
' '
,
'%'
,
's'
,
']'
,
0
};
static
const
WCHAR
arrayW
[]
=
{
'A'
,
'r'
,
'r'
,
'a'
,
'y'
,
0
};
static
const
WCHAR
booleanW
[]
=
{
'B'
,
'o'
,
'o'
,
'l'
,
'e'
,
'a'
,
'n'
,
0
};
static
const
WCHAR
dateW
[]
=
{
'D'
,
'a'
,
't'
,
'e'
,
0
};
static
const
WCHAR
errorW
[]
=
{
'E'
,
'r'
,
'r'
,
'o'
,
'r'
,
0
};
static
const
WCHAR
functionW
[]
=
{
'F'
,
'u'
,
'n'
,
'c'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
const
WCHAR
mathW
[]
=
{
'M'
,
'a'
,
't'
,
'h'
,
0
};
static
const
WCHAR
numberW
[]
=
{
'N'
,
'u'
,
'm'
,
'b'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
objectW
[]
=
{
'O'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
0
};
static
const
WCHAR
regexpW
[]
=
{
'R'
,
'e'
,
'g'
,
'E'
,
'x'
,
'p'
,
0
};
static
const
WCHAR
stringW
[]
=
{
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
/* Keep in sync with jsclass_t enum */
static
const
WCHAR
*
names
[]
=
{
NULL
,
arrayW
,
booleanW
,
dateW
,
errorW
,
functionW
,
NULL
,
mathW
,
numberW
,
objectW
,
regexpW
,
stringW
};
TRACE
(
"
\n
"
);
if
(
names
[
dispex
->
builtin_info
->
class
]
==
NULL
)
{
ERR
(
"dispex->builtin_info->class = %d
\n
"
,
dispex
->
builtin_info
->
class
);
return
E_FAIL
;
}
if
(
retv
)
{
V_VT
(
retv
)
=
VT_BSTR
;
V_BSTR
(
retv
)
=
SysAllocString
(
default_valueW
);
V_BSTR
(
retv
)
=
SysAllocString
Len
(
NULL
,
9
+
strlenW
(
names
[
dispex
->
builtin_info
->
class
])
);
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
sprintfW
(
V_BSTR
(
retv
),
formatW
,
names
[
dispex
->
builtin_info
->
class
]);
}
return
S_OK
;
...
...
dlls/jscript/tests/api.js
View file @
f5e678e8
...
...
@@ -60,6 +60,22 @@ ok(tmp === "abc", "encodeURI('abc') = " + tmp);
tmp
=
""
+
new
Object
();
ok
(
tmp
===
"[object Object]"
,
"'' + new Object() = "
+
tmp
);
(
tmp
=
new
Array
).
f
=
Object
.
prototype
.
toString
;
ok
(
tmp
.
f
()
===
"[object Array]"
,
"tmp.f() = "
+
tmp
.
f
());
(
tmp
=
new
Boolean
).
f
=
Object
.
prototype
.
toString
;
ok
(
tmp
.
f
()
===
"[object Boolean]"
,
"tmp.f() = "
+
tmp
.
f
());
(
tmp
=
new
Date
).
f
=
Object
.
prototype
.
toString
;
ok
(
tmp
.
f
()
===
"[object Date]"
,
"tmp.f() = "
+
tmp
.
f
());
(
tmp
=
function
()
{}).
f
=
Object
.
prototype
.
toString
;
ok
(
tmp
.
f
()
===
"[object Function]"
,
"tmp.f() = "
+
tmp
.
f
());
Math
.
f
=
Object
.
prototype
.
toString
;
ok
(
Math
.
f
()
===
"[object Math]"
,
"tmp.f() = "
+
tmp
.
f
());
(
tmp
=
new
Number
).
f
=
Object
.
prototype
.
toString
;
ok
(
tmp
.
f
()
===
"[object Number]"
,
"tmp.f() = "
+
tmp
.
f
());
(
tmp
=
new
RegExp
(
""
)).
f
=
Object
.
prototype
.
toString
;
ok
(
tmp
.
f
()
===
"[object RegExp]"
,
"tmp.f() = "
+
tmp
.
f
());
(
tmp
=
new
String
).
f
=
Object
.
prototype
.
toString
;
ok
(
tmp
.
f
()
===
"[object String]"
,
"tmp.f() = "
+
tmp
.
f
());
ok
(
""
.
length
===
0
,
"
\"\"
.length = "
+
""
.
length
);
ok
(
getVT
(
""
.
length
)
==
"VT_I4"
,
"
\"\"
.length = "
+
""
.
length
);
...
...
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