Selaa lähdekoodia

LibJS: Make bytecode interpreter leave unwind context immediately

We were missing some "break" statements, causing us to actually finish
executing everything within "try" blocks before actually jumping to the
"catch" and/or "finally" blocks.
Andreas Kling 3 vuotta sitten
vanhempi
commit
049b755123
1 muutettua tiedostoa jossa 4 lisäystä ja 1 poistoa
  1. 4 1
      Userland/Libraries/LibJS/Bytecode/Interpreter.cpp

+ 4 - 1
Userland/Libraries/LibJS/Bytecode/Interpreter.cpp

@@ -88,12 +88,15 @@ Value Interpreter::run(Executable const& executable, BasicBlock const* entry_poi
                     accumulator() = vm().exception()->value();
                     vm().clear_exception();
                     will_jump = true;
-                } else if (unwind_context.finalizer) {
+                    break;
+                }
+                if (unwind_context.finalizer) {
                     block = unwind_context.finalizer;
                     m_unwind_contexts.take_last();
                     will_jump = true;
                     m_saved_exception = Handle<Exception>::create(vm().exception());
                     vm().clear_exception();
+                    break;
                 }
             }
             if (m_pending_jump.has_value()) {