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
6263f007
Commit
6263f007
authored
Aug 02, 2010
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 02, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Use generic property for Error.number.
parent
636bc749
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
35 deletions
+19
-35
error.c
dlls/jscript/error.c
+13
-35
api.js
dlls/jscript/tests/api.js
+6
-0
No files found.
dlls/jscript/error.c
View file @
6263f007
...
...
@@ -29,7 +29,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(jscript);
typedef
struct
{
DispatchEx
dispex
;
VARIANT
number
;
VARIANT
description
;
VARIANT
message
;
}
ErrorInstance
;
...
...
@@ -50,24 +49,6 @@ 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
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
ErrorInstance
*
This
=
error_from_vdisp
(
jsthis
);
TRACE
(
"
\n
"
);
switch
(
flags
)
{
case
DISPATCH_PROPERTYGET
:
return
VariantCopy
(
retv
,
&
This
->
number
);
case
DISPATCH_PROPERTYPUT
:
return
VariantCopy
(
&
This
->
number
,
get_arg
(
dp
,
0
));
default:
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
return
E_NOTIMPL
;
}
}
static
HRESULT
Error_description
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
...
...
@@ -203,7 +184,6 @@ static void Error_destructor(DispatchEx *dispex)
{
ErrorInstance
*
This
=
(
ErrorInstance
*
)
dispex
;
VariantClear
(
&
This
->
number
);
VariantClear
(
&
This
->
description
);
VariantClear
(
&
This
->
message
);
heap_free
(
This
);
...
...
@@ -212,7 +192,6 @@ static void Error_destructor(DispatchEx *dispex)
static
const
builtin_prop_t
Error_props
[]
=
{
{
descriptionW
,
Error_description
,
0
},
{
messageW
,
Error_message
,
0
},
{
numberW
,
Error_number
,
0
},
{
toStringW
,
Error_toString
,
PROPF_METHOD
}
};
...
...
@@ -228,7 +207,6 @@ static const builtin_info_t Error_info = {
static
const
builtin_prop_t
ErrorInst_props
[]
=
{
{
descriptionW
,
Error_description
,
0
},
{
messageW
,
Error_message
,
0
},
{
numberW
,
Error_number
,
0
},
};
static
const
builtin_info_t
ErrorInst_info
=
{
...
...
@@ -265,18 +243,22 @@ static HRESULT alloc_error(script_ctx_t *ctx, DispatchEx *prototype,
}
static
HRESULT
create_error
(
script_ctx_t
*
ctx
,
DispatchEx
*
constr
,
const
UINT
*
number
,
const
WCHAR
*
msg
,
DispatchEx
**
ret
)
UINT
number
,
const
WCHAR
*
msg
,
DispatchEx
**
ret
)
{
ErrorInstance
*
err
;
VARIANT
v
;
HRESULT
hres
;
hres
=
alloc_error
(
ctx
,
NULL
,
constr
,
&
err
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
number
)
{
V_VT
(
&
err
->
number
)
=
VT_I4
;
V_I4
(
&
err
->
number
)
=
*
number
;
V_VT
(
&
v
)
=
VT_I4
;
V_I4
(
&
v
)
=
number
;
hres
=
jsdisp_propput_name
(
&
err
->
dispex
,
numberW
,
&
v
,
NULL
/*FIXME*/
,
NULL
/*FIXME*/
);
if
(
FAILED
(
hres
))
{
jsdisp_release
(
&
err
->
dispex
);
return
hres
;
}
V_VT
(
&
err
->
message
)
=
VT_BSTR
;
...
...
@@ -297,14 +279,13 @@ static HRESULT create_error(script_ctx_t *ctx, DispatchEx *constr,
static
HRESULT
error_constr
(
script_ctx_t
*
ctx
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
DispatchEx
*
constr
)
{
DispatchEx
*
err
;
VARIANT
numv
;
UINT
num
;
UINT
num
=
0
;
BSTR
msg
=
NULL
;
HRESULT
hres
;
V_VT
(
&
numv
)
=
VT_NULL
;
if
(
arg_cnt
(
dp
))
{
VARIANT
numv
;
hres
=
to_number
(
ctx
,
get_arg
(
dp
,
0
),
ei
,
&
numv
);
if
(
FAILED
(
hres
)
||
(
V_VT
(
&
numv
)
==
VT_R8
&&
isnan
(
V_R8
(
&
numv
))))
hres
=
to_string
(
ctx
,
get_arg
(
dp
,
0
),
ei
,
&
msg
);
...
...
@@ -326,10 +307,7 @@ static HRESULT error_constr(script_ctx_t *ctx, WORD flags, DISPPARAMS *dp,
switch
(
flags
)
{
case
INVOKE_FUNC
:
case
DISPATCH_CONSTRUCT
:
if
(
V_VT
(
&
numv
)
==
VT_NULL
)
hres
=
create_error
(
ctx
,
constr
,
NULL
,
msg
,
&
err
);
else
hres
=
create_error
(
ctx
,
constr
,
&
num
,
msg
,
&
err
);
hres
=
create_error
(
ctx
,
constr
,
num
,
msg
,
&
err
);
SysFreeString
(
msg
);
if
(
FAILED
(
hres
))
...
...
@@ -477,7 +455,7 @@ static HRESULT throw_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCH
WARN
(
"%s
\n
"
,
debugstr_w
(
buf
));
id
|=
JSCRIPT_ERROR
;
hres
=
create_error
(
ctx
,
constr
,
&
id
,
buf
,
&
err
);
hres
=
create_error
(
ctx
,
constr
,
id
,
buf
,
&
err
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/tests/api.js
View file @
6263f007
...
...
@@ -1772,10 +1772,16 @@ ok(err.message === "message", "err.message !== 'message'");
ok
(
err
.
toString
()
===
(
invokeVersion
<
2
?
"[object Error]"
:
"Error: message"
),
"err.toString() = "
+
err
.
toString
());
err
=
new
Error
(
123
);
ok
(
err
.
number
===
123
,
"err.number = "
+
err
.
number
);
err
.
number
=
254
;
ok
(
err
.
number
===
254
,
"err.number = "
+
err
.
number
);
err
=
new
Error
(
0
,
"message"
);
ok
(
err
.
number
===
0
,
"err.number = "
+
err
.
number
);
ok
(
err
.
message
===
"message"
,
"err.message = "
+
err
.
message
);
ok
(
err
.
description
===
"message"
,
"err.description = "
+
err
.
description
);
err
=
new
Error
();
ok
(
err
.
number
===
0
,
"err.number = "
+
err
.
number
);
ok
(
!
(
"number"
in
Error
),
"number is in Error"
);
tmp
=
new
Object
();
tmp
.
toString
=
function
()
{
return
"test"
;
};
...
...
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