Ver código fonte

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.
Linus Groh 5 anos atrás
pai
commit
36c738d9bf
1 arquivos alterados com 2 adições e 0 exclusões
  1. 2 0
      Libraries/LibJS/Interpreter.cpp

+ 2 - 0
Libraries/LibJS/Interpreter.cpp

@@ -60,6 +60,8 @@ Interpreter::~Interpreter()
 
 
 Value Interpreter::run(GlobalObject& global_object, const Statement& statement, ArgumentVector arguments, ScopeType scope_type)
 Value Interpreter::run(GlobalObject& global_object, const Statement& statement, ArgumentVector arguments, ScopeType scope_type)
 {
 {
+    ASSERT(!exception());
+
     if (statement.is_program()) {
     if (statement.is_program()) {
         if (m_call_stack.is_empty()) {
         if (m_call_stack.is_empty()) {
             CallFrame global_call_frame;
             CallFrame global_call_frame;