mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibJS: Reset Bytecode::Interpreter's m_return_value when leaving run()
Otherwise it will cause complete unwind since all parent run() loops will see the same m_return_value being non-empty and break out.
This commit is contained in:
parent
9330163b0b
commit
845f2826aa
Notes:
sideshowbarker
2024-07-18 12:41:49 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/845f2826aa0
1 changed files with 4 additions and 3 deletions
|
@ -77,16 +77,17 @@ Value Interpreter::run(Bytecode::Block const& block)
|
|||
|
||||
m_register_windows.take_last();
|
||||
|
||||
m_return_value = m_return_value.value_or(js_undefined());
|
||||
auto return_value = m_return_value.value_or(js_undefined());
|
||||
m_return_value = {};
|
||||
|
||||
// NOTE: The return value from a called function is put into $0 in the caller context.
|
||||
if (!m_register_windows.is_empty())
|
||||
m_register_windows.last()[0] = m_return_value;
|
||||
m_register_windows.last()[0] = return_value;
|
||||
|
||||
if (vm().call_stack().size() == 1)
|
||||
vm().pop_call_frame();
|
||||
|
||||
return m_return_value;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue