mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-06 09:01:53 +00:00
LibJS: Don't copy current program counter into new execution contexts
This didn't make any sense, and was already handled by pushing a new execution context anyway. By simply removing these bogus lines of code, we fix a bug where throwing inside a function whose bytecode was shorter than the calling function would crash trying to generate an Error stack trace (because the bytecode offset we were trying to symbolicate was actually from the longer caller function, and not valid in the callee function.) This makes --log-all-js-exceptions less crash prone and more helpful.
This commit is contained in:
parent
0c77b3bf59
commit
b3f77e4769
Notes:
github-actions[bot]
2024-09-08 09:34:39 +00:00
Author: https://github.com/awesomekling
Commit: b3f77e4769
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1324
3 changed files with 20 additions and 4 deletions
|
@ -387,7 +387,6 @@ ThrowCompletionOr<Value> ECMAScriptFunctionObject::internal_call(Value this_argu
|
|||
// Non-standard
|
||||
callee_context->arguments.ensure_capacity(max(arguments_list.size(), m_formal_parameters.size()));
|
||||
callee_context->arguments.append(arguments_list.data(), arguments_list.size());
|
||||
callee_context->program_counter = vm.bytecode_interpreter().program_counter();
|
||||
callee_context->passed_argument_count = arguments_list.size();
|
||||
if (arguments_list.size() < m_formal_parameters.size()) {
|
||||
for (size_t i = arguments_list.size(); i < m_formal_parameters.size(); ++i)
|
||||
|
@ -462,7 +461,6 @@ ThrowCompletionOr<NonnullGCPtr<Object>> ECMAScriptFunctionObject::internal_const
|
|||
// Non-standard
|
||||
callee_context->arguments.ensure_capacity(max(arguments_list.size(), m_formal_parameters.size()));
|
||||
callee_context->arguments.append(arguments_list.data(), arguments_list.size());
|
||||
callee_context->program_counter = vm.bytecode_interpreter().program_counter();
|
||||
callee_context->passed_argument_count = arguments_list.size();
|
||||
if (arguments_list.size() < m_formal_parameters.size()) {
|
||||
for (size_t i = arguments_list.size(); i < m_formal_parameters.size(); ++i)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue