diff options
author | Linus Groh <mail@linusgroh.de> | 2020-08-11 17:45:57 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-11 21:08:30 +0200 |
commit | 36c738d9bf5089875c769edf17fec249df15dc9a (patch) | |
tree | aaf5396038900d671c805f7f7daf223339fb41de /Libraries | |
parent | 1d728af5c46045245ada2141d39b6ccc9fcafc8a (diff) | |
download | serenity-36c738d9bf5089875c769edf17fec249df15dc9a.zip |
LibJS: Assert when exception is not cleared before Interpreter::run()
This is to prevent bugs like #3091 (fixed in
9810f8872c21eaf2aefff25347d957cd26f34c2d) in the future; we generally
don't want Interpreter::run() to be called if the interpreter still has
an exception stored. Sure, it could clear those itself but letting users
of the interpreter do it explicitly seems sensible.
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibJS/Interpreter.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Libraries/LibJS/Interpreter.cpp b/Libraries/LibJS/Interpreter.cpp index e00fa47c45..5c9836789b 100644 --- a/Libraries/LibJS/Interpreter.cpp +++ b/Libraries/LibJS/Interpreter.cpp @@ -60,6 +60,8 @@ Interpreter::~Interpreter() Value Interpreter::run(GlobalObject& global_object, const Statement& statement, ArgumentVector arguments, ScopeType scope_type) { + ASSERT(!exception()); + if (statement.is_program()) { if (m_call_stack.is_empty()) { CallFrame global_call_frame; |