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
86e7beae
Commit
86e7beae
authored
Oct 19, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 20, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added Error.toString implementation for invoke version >= 2.
parent
96cbc45a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
2 deletions
+67
-2
error.c
dlls/jscript/error.c
+67
-2
No files found.
dlls/jscript/error.c
View file @
86e7beae
...
@@ -36,6 +36,7 @@ typedef struct {
...
@@ -36,6 +36,7 @@ typedef struct {
static
const
WCHAR
descriptionW
[]
=
{
'd'
,
'e'
,
's'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
const
WCHAR
descriptionW
[]
=
{
'd'
,
'e'
,
's'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
const
WCHAR
messageW
[]
=
{
'm'
,
'e'
,
's'
,
's'
,
'a'
,
'g'
,
'e'
,
0
};
static
const
WCHAR
messageW
[]
=
{
'm'
,
'e'
,
's'
,
's'
,
'a'
,
'g'
,
'e'
,
0
};
static
const
WCHAR
nameW
[]
=
{
'n'
,
'a'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
numberW
[]
=
{
'n'
,
'u'
,
'm'
,
'b'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
numberW
[]
=
{
'n'
,
'u'
,
'm'
,
'b'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
toStringW
[]
=
{
't'
,
'o'
,
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
static
const
WCHAR
toStringW
[]
=
{
't'
,
'o'
,
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
...
@@ -44,6 +45,11 @@ static inline ErrorInstance *error_from_vdisp(vdisp_t *vdisp)
...
@@ -44,6 +45,11 @@ static inline ErrorInstance *error_from_vdisp(vdisp_t *vdisp)
return
(
ErrorInstance
*
)
vdisp
->
u
.
jsdisp
;
return
(
ErrorInstance
*
)
vdisp
->
u
.
jsdisp
;
}
}
static
inline
ErrorInstance
*
error_this
(
vdisp_t
*
jsthis
)
{
return
is_vclass
(
jsthis
,
JSCLASS_ERROR
)
?
error_from_vdisp
(
jsthis
)
:
NULL
;
}
static
HRESULT
Error_number
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
static
HRESULT
Error_number
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
{
...
@@ -101,18 +107,78 @@ static HRESULT Error_message(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -101,18 +107,78 @@ static HRESULT Error_message(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
/* ECMA-262 3rd Edition 15.11.4.4 */
/* ECMA-262 3rd Edition 15.11.4.4 */
static
HRESULT
Error_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
static
HRESULT
Error_toString
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
{
{
ErrorInstance
*
error
;
BSTR
name
,
msg
=
NULL
,
ret
=
NULL
;
VARIANT
v
;
HRESULT
hres
;
static
const
WCHAR
str
[]
=
{
'['
,
'o'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
' '
,
'E'
,
'r'
,
'r'
,
'o'
,
'r'
,
']'
,
0
};
static
const
WCHAR
str
[]
=
{
'['
,
'o'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
' '
,
'E'
,
'r'
,
'r'
,
'o'
,
'r'
,
']'
,
0
};
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
error
=
error_this
(
jsthis
);
if
(
ctx
->
version
<
2
||
!
error
)
{
if
(
retv
)
{
if
(
retv
)
{
V_VT
(
retv
)
=
VT_BSTR
;
V_VT
(
retv
)
=
VT_BSTR
;
V_BSTR
(
retv
)
=
SysAllocString
(
str
);
V_BSTR
(
retv
)
=
SysAllocString
(
str
);
if
(
!
V_BSTR
(
retv
))
if
(
!
V_BSTR
(
retv
))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
return
S_OK
;
}
hres
=
jsdisp_propget_name
(
&
error
->
dispex
,
nameW
,
&
v
,
ei
,
caller
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_string
(
ctx
,
&
v
,
ei
,
&
name
);
VariantClear
(
&
v
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
V_VT
(
&
error
->
message
)
!=
VT_EMPTY
)
{
hres
=
to_string
(
ctx
,
&
error
->
message
,
ei
,
&
msg
);
if
(
SUCCEEDED
(
hres
)
&&
!*
msg
)
{
SysFreeString
(
msg
);
msg
=
NULL
;
}
}
if
(
SUCCEEDED
(
hres
))
{
if
(
msg
)
{
DWORD
name_len
,
msg_len
;
name_len
=
SysStringLen
(
name
);
msg_len
=
SysStringLen
(
msg
);
ret
=
SysAllocStringLen
(
NULL
,
name_len
+
msg_len
+
2
);
if
(
ret
)
{
memcpy
(
ret
,
name
,
name_len
*
sizeof
(
WCHAR
));
ret
[
name_len
]
=
':'
;
ret
[
name_len
+
1
]
=
' '
;
memcpy
(
ret
+
name_len
+
2
,
msg
,
msg_len
*
sizeof
(
WCHAR
));
}
}
else
{
ret
=
name
;
name
=
NULL
;
}
}
SysFreeString
(
msg
);
SysFreeString
(
name
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
!
ret
)
return
E_OUTOFMEMORY
;
if
(
retv
)
{
V_VT
(
retv
)
=
VT_BSTR
;
V_BSTR
(
retv
)
=
ret
;
}
else
{
SysFreeString
(
ret
);
}
return
S_OK
;
return
S_OK
;
}
}
...
@@ -341,7 +407,6 @@ static HRESULT URIErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
...
@@ -341,7 +407,6 @@ static HRESULT URIErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
HRESULT
init_error_constr
(
script_ctx_t
*
ctx
,
DispatchEx
*
object_prototype
)
HRESULT
init_error_constr
(
script_ctx_t
*
ctx
,
DispatchEx
*
object_prototype
)
{
{
static
const
WCHAR
nameW
[]
=
{
'n'
,
'a'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
ErrorW
[]
=
{
'E'
,
'r'
,
'r'
,
'o'
,
'r'
,
0
};
static
const
WCHAR
ErrorW
[]
=
{
'E'
,
'r'
,
'r'
,
'o'
,
'r'
,
0
};
static
const
WCHAR
EvalErrorW
[]
=
{
'E'
,
'v'
,
'a'
,
'l'
,
'E'
,
'r'
,
'r'
,
'o'
,
'r'
,
0
};
static
const
WCHAR
EvalErrorW
[]
=
{
'E'
,
'v'
,
'a'
,
'l'
,
'E'
,
'r'
,
'r'
,
'o'
,
'r'
,
0
};
static
const
WCHAR
RangeErrorW
[]
=
{
'R'
,
'a'
,
'n'
,
'g'
,
'e'
,
'E'
,
'r'
,
'r'
,
'o'
,
'r'
,
0
};
static
const
WCHAR
RangeErrorW
[]
=
{
'R'
,
'a'
,
'n'
,
'g'
,
'e'
,
'E'
,
'r'
,
'r'
,
'o'
,
'r'
,
0
};
...
...
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