mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 07:09:47 +00:00
js: Don't print last value after exception and return non-success
If in 'foo(); bar();' bar fails, we'd get the error of that and then foo's return value - that's probably not something anyone expects. Also make sure to return non-success so the process will exit with 1.
This commit is contained in:
parent
1ef0078b4c
commit
cf127b745e
Notes:
sideshowbarker
2024-07-18 21:14:43 +09:00
Author: https://github.com/linusg
Commit: cf127b745e
Pull-request: https://github.com/SerenityOS/serenity/pull/5858
1 changed files with 8 additions and 5 deletions
|
@ -495,13 +495,16 @@ static bool parse_and_run(JS::Interpreter& interpreter, const StringView& source
|
||||||
}
|
}
|
||||||
vm->clear_exception();
|
vm->clear_exception();
|
||||||
};
|
};
|
||||||
if (vm->exception())
|
|
||||||
handle_exception();
|
|
||||||
|
|
||||||
if (s_print_last_result) {
|
if (vm->exception()) {
|
||||||
|
handle_exception();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (s_print_last_result)
|
||||||
print(vm->last_value());
|
print(vm->last_value());
|
||||||
if (vm->exception())
|
if (vm->exception()) {
|
||||||
handle_exception();
|
return false;
|
||||||
|
handle_exception();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue