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
3c9b7011
Commit
3c9b7011
authored
Jan 30, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Jan 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Store separated flag indicating if current exception value is valid.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
63683b42
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
10 deletions
+28
-10
engine.c
dlls/jscript/engine.c
+20
-7
engine.h
dlls/jscript/engine.h
+2
-0
error.c
dlls/jscript/error.c
+2
-1
jscript.c
dlls/jscript/jscript.c
+4
-2
No files found.
dlls/jscript/engine.c
View file @
3c9b7011
...
...
@@ -855,13 +855,21 @@ static HRESULT interp_case(script_ctx_t *ctx)
return
S_OK
;
}
static
void
set_error_value
(
script_ctx_t
*
ctx
,
jsval_t
value
)
{
jsexcept_t
*
ei
=
ctx
->
ei
;
reset_ei
(
ei
);
ei
->
valid_value
=
TRUE
;
ei
->
value
=
value
;
}
/* ECMA-262 3rd Edition 12.13 */
static
HRESULT
interp_throw
(
script_ctx_t
*
ctx
)
{
TRACE
(
"
\n
"
);
jsval_release
(
ctx
->
ei
->
value
);
ctx
->
ei
->
value
=
stack_pop
(
ctx
);
set_error_value
(
ctx
,
stack_pop
(
ctx
));
return
DISP_E_EXCEPTION
;
}
...
...
@@ -957,7 +965,7 @@ static HRESULT interp_end_finally(script_ctx_t *ctx)
if
(
!
get_bool
(
v
))
{
TRACE
(
"passing exception
\n
"
);
ctx
->
ei
->
value
=
stack_pop
(
ctx
);
set_error_value
(
ctx
,
stack_pop
(
ctx
)
);
return
DISP_E_EXCEPTION
;
}
...
...
@@ -2713,6 +2721,7 @@ static void print_backtrace(script_ctx_t *ctx)
static
HRESULT
unwind_exception
(
script_ctx_t
*
ctx
,
HRESULT
exception_hres
)
{
except_frame_t
*
except_frame
;
jsexcept_t
*
ei
=
ctx
->
ei
;
call_frame_t
*
frame
;
jsval_t
except_val
;
unsigned
catch_off
;
...
...
@@ -2724,8 +2733,8 @@ static HRESULT unwind_exception(script_ctx_t *ctx, HRESULT exception_hres)
static
const
WCHAR
messageW
[]
=
{
'm'
,
'e'
,
's'
,
's'
,
'a'
,
'g'
,
'e'
,
0
};
WARN
(
"Exception %08x %s"
,
exception_hres
,
debugstr_jsval
(
ctx
->
ei
->
value
));
if
(
jsval_type
(
ctx
->
ei
->
value
)
==
JSV_OBJECT
)
{
WARN
(
"Exception %08x %s"
,
exception_hres
,
debugstr_jsval
(
ei
->
valid_value
?
ei
->
value
:
jsval_undefined
()
));
if
(
ei
->
valid_value
&&
jsval_type
(
ctx
->
ei
->
value
)
==
JSV_OBJECT
)
{
error_obj
=
to_jsdisp
(
get_object
(
ctx
->
ei
->
value
));
if
(
error_obj
)
{
hres
=
jsdisp_propget_name
(
error_obj
,
messageW
,
&
msg
);
...
...
@@ -2766,8 +2775,12 @@ static HRESULT unwind_exception(script_ctx_t *ctx, HRESULT exception_hres)
frame
->
ip
=
catch_off
?
catch_off
:
except_frame
->
finally_off
;
if
(
catch_off
)
assert
(
frame
->
bytecode
->
instrs
[
frame
->
ip
].
op
==
OP_enter_catch
);
except_val
=
ctx
->
ei
->
value
;
ctx
->
ei
->
value
=
jsval_undefined
();
if
(
ei
->
valid_value
)
{
except_val
=
ctx
->
ei
->
value
;
ctx
->
ei
->
valid_value
=
FALSE
;
}
else
{
except_val
=
jsval_undefined
();
}
/* keep current except_frame if we're entering catch block with finally block associated */
if
(
catch_off
&&
except_frame
->
finally_off
)
{
...
...
dlls/jscript/engine.h
View file @
3c9b7011
...
...
@@ -222,7 +222,9 @@ static inline scope_chain_t *scope_addref(scope_chain_t *scope)
}
struct
_jsexcept_t
{
BOOL
valid_value
;
jsval_t
value
;
jsexcept_t
*
prev
;
};
...
...
dlls/jscript/error.c
View file @
3c9b7011
...
...
@@ -404,7 +404,8 @@ static HRESULT throw_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str, j
if
(
FAILED
(
hres
))
return
hres
;
jsval_release
(
ctx
->
ei
->
value
);
reset_ei
(
ctx
->
ei
);
ctx
->
ei
->
valid_value
=
TRUE
;
ctx
->
ei
->
value
=
jsval_obj
(
err
);
return
error
;
}
...
...
dlls/jscript/jscript.c
View file @
3c9b7011
...
...
@@ -103,8 +103,10 @@ static inline BOOL is_started(script_ctx_t *ctx)
void
reset_ei
(
jsexcept_t
*
ei
)
{
jsval_release
(
ei
->
value
);
ei
->
value
=
jsval_undefined
();
if
(
ei
->
valid_value
)
{
jsval_release
(
ei
->
value
);
ei
->
valid_value
=
FALSE
;
}
}
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