mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 16:19:23 +00:00
LibJS: Make Value() default-construct the undefined value
The special empty value (that we use for array holes, Optional<Value> when empty and a few other other placeholder/sentinel tasks) still exists, but you now create one via JS::js_special_empty_value() and check for it with Value::is_special_empty_value(). The main idea here is to make it very unlikely to accidentally create an unexpected special empty value.
This commit is contained in:
parent
0d91363742
commit
3cf50539ec
Notes:
github-actions[bot]
2025-04-05 09:21:31 +00:00
Author: https://github.com/awesomekling
Commit: 3cf50539ec
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4232
43 changed files with 165 additions and 122 deletions
|
@ -46,7 +46,7 @@ ErrorOr<String> MarkupGenerator::html_from_error(Error const& object, bool in_pr
|
|||
|
||||
ErrorOr<void> MarkupGenerator::value_to_html(Value value, StringBuilder& output_html, HashTable<Object*>& seen_objects)
|
||||
{
|
||||
if (value.is_empty()) {
|
||||
if (value.is_special_empty_value()) {
|
||||
TRY(output_html.try_append("<empty>"sv));
|
||||
return {};
|
||||
}
|
||||
|
@ -166,8 +166,8 @@ ErrorOr<void> MarkupGenerator::trace_to_html(TracebackFrame const& traceback_fra
|
|||
ErrorOr<void> MarkupGenerator::error_to_html(Error const& error, StringBuilder& html_output, bool in_promise)
|
||||
{
|
||||
auto& vm = error.vm();
|
||||
auto name = error.get_without_side_effects(vm.names.name).value_or(js_undefined());
|
||||
auto message = error.get_without_side_effects(vm.names.message).value_or(js_undefined());
|
||||
auto name = error.get_without_side_effects(vm.names.name);
|
||||
auto message = error.get_without_side_effects(vm.names.message);
|
||||
auto name_string = name.to_string_without_side_effects();
|
||||
auto message_string = message.to_string_without_side_effects();
|
||||
auto uncaught_message = TRY(String::formatted("Uncaught {}[{}]: ", in_promise ? "(in promise) " : "", name_string));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue