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
bcba0722
Commit
bcba0722
authored
Feb 03, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Support propagating error message.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0f4d4f71
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
3 deletions
+22
-3
dispex.c
dlls/jscript/dispex.c
+2
-0
engine.c
dlls/jscript/engine.c
+12
-2
engine.h
dlls/jscript/engine.h
+1
-0
error.c
dlls/jscript/error.c
+3
-1
jscript.c
dlls/jscript/jscript.c
+4
-0
No files found.
dlls/jscript/dispex.c
View file @
bcba0722
...
...
@@ -1978,6 +1978,8 @@ static HRESULT disp_invoke(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD f
ctx
->
ei
->
error
=
(
SUCCEEDED
(
ei
.
scode
)
||
ei
.
scode
==
DISP_E_EXCEPTION
)
?
E_FAIL
:
ei
.
scode
;
if
(
ei
.
bstrSource
)
ctx
->
ei
->
source
=
jsstr_alloc_len
(
ei
.
bstrSource
,
SysStringLen
(
ei
.
bstrSource
));
if
(
ei
.
bstrDescription
)
ctx
->
ei
->
message
=
jsstr_alloc_len
(
ei
.
bstrDescription
,
SysStringLen
(
ei
.
bstrDescription
));
SysFreeString
(
ei
.
bstrSource
);
SysFreeString
(
ei
.
bstrDescription
);
SysFreeString
(
ei
.
bstrHelpFile
);
...
...
dlls/jscript/engine.c
View file @
bcba0722
...
...
@@ -867,6 +867,7 @@ static void set_error_value(script_ctx_t *ctx, jsval_t value)
if
(
is_object_instance
(
value
)
&&
get_object
(
value
)
&&
(
obj
=
to_jsdisp
(
get_object
(
value
))))
{
UINT32
number
;
jsstr_t
*
str
;
jsval_t
v
;
HRESULT
hres
;
...
...
@@ -879,8 +880,15 @@ static void set_error_value(script_ctx_t *ctx, jsval_t value)
ei
->
error
=
FAILED
(
number
)
?
number
:
E_FAIL
;
jsval_release
(
v
);
}
}
hres
=
jsdisp_propget_name
(
obj
,
L"description"
,
&
v
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
to_string
(
ctx
,
v
,
&
str
);
if
(
SUCCEEDED
(
hres
))
ei
->
message
=
str
;
jsval_release
(
v
);
}
}
}
/* ECMA-262 3rd Edition 12.13 */
...
...
@@ -2769,8 +2777,10 @@ static HRESULT unwind_exception(script_ctx_t *ctx, HRESULT exception_hres)
}
frame
=
ctx
->
call_ctx
;
if
(
exception_hres
!=
DISP_E_EXCEPTION
)
if
(
exception_hres
!=
DISP_E_EXCEPTION
)
{
reset_ei
(
ei
);
ei
->
error
=
exception_hres
;
}
set_error_location
(
ei
,
frame
->
bytecode
,
frame
->
bytecode
->
instrs
[
frame
->
ip
].
loc
,
IDS_RUNTIME_ERROR
);
while
(
!
frame
->
except_frame
)
{
...
...
dlls/jscript/engine.h
View file @
bcba0722
...
...
@@ -228,6 +228,7 @@ struct _jsexcept_t {
jsval_t
value
;
jsstr_t
*
source
;
jsstr_t
*
message
;
bytecode_t
*
code
;
unsigned
loc
;
...
...
dlls/jscript/error.c
View file @
bcba0722
...
...
@@ -455,6 +455,8 @@ void set_error_location(jsexcept_t *ei, bytecode_t *code, unsigned loc, unsigned
len
=
LoadStringW
(
jscript_hinstance
,
source_id
,
(
WCHAR
*
)
&
res
,
0
);
ei
->
source
=
jsstr_alloc_len
(
res
,
len
);
}
if
(
!
ei
->
message
)
ei
->
message
=
format_error_message
(
ei
->
error
,
NULL
);
}
TRACE
(
"source %s in %s
\n
"
,
debugstr_w
(
code
->
source
+
loc
),
debugstr_w
(
code
->
source
));
...
...
@@ -538,6 +540,6 @@ jsdisp_t *create_builtin_error(script_ctx_t *ctx)
}
}
hres
=
create_error
(
ctx
,
constr
,
ei
->
error
,
jsstr_empty
(),
&
r
);
hres
=
create_error
(
ctx
,
constr
,
ei
->
error
,
ei
->
message
?
ei
->
message
:
jsstr_empty
(),
&
r
);
return
SUCCEEDED
(
hres
)
?
r
:
NULL
;
}
dlls/jscript/jscript.c
View file @
bcba0722
...
...
@@ -223,6 +223,10 @@ void reset_ei(jsexcept_t *ei)
jsstr_release
(
ei
->
source
);
ei
->
source
=
NULL
;
}
if
(
ei
->
message
)
{
jsstr_release
(
ei
->
message
);
ei
->
message
=
NULL
;
}
}
void
enter_script
(
script_ctx_t
*
ctx
,
jsexcept_t
*
ei
)
...
...
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