mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:17:34 +00:00
LibJS: Avoid unnecessary PropertyName creation in MarkupGenerator
This commit is contained in:
parent
f35c25a7eb
commit
9fd9e424ff
1 changed files with 4 additions and 2 deletions
|
@ -12,6 +12,7 @@
|
||||||
#include <LibJS/Runtime/Date.h>
|
#include <LibJS/Runtime/Date.h>
|
||||||
#include <LibJS/Runtime/Error.h>
|
#include <LibJS/Runtime/Error.h>
|
||||||
#include <LibJS/Runtime/Object.h>
|
#include <LibJS/Runtime/Object.h>
|
||||||
|
#include <LibJS/Runtime/VM.h>
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
||||||
|
@ -144,8 +145,9 @@ void MarkupGenerator::date_to_html(const Object& date, StringBuilder& html_outpu
|
||||||
|
|
||||||
void MarkupGenerator::error_to_html(const Object& object, StringBuilder& html_output, HashTable<Object*>&)
|
void MarkupGenerator::error_to_html(const Object& object, StringBuilder& html_output, HashTable<Object*>&)
|
||||||
{
|
{
|
||||||
auto name = object.get_without_side_effects(PropertyName("name")).value_or(JS::js_undefined());
|
auto& vm = object.vm();
|
||||||
auto message = object.get_without_side_effects(PropertyName("message")).value_or(JS::js_undefined());
|
auto name = object.get_without_side_effects(vm.names.name).value_or(JS::js_undefined());
|
||||||
|
auto message = object.get_without_side_effects(vm.names.message).value_or(JS::js_undefined());
|
||||||
if (name.is_accessor() || name.is_native_property() || message.is_accessor() || message.is_native_property()) {
|
if (name.is_accessor() || name.is_native_property() || message.is_accessor() || message.is_native_property()) {
|
||||||
html_output.append(wrap_string_in_style(JS::Value(&object).to_string_without_side_effects(), StyleType::Invalid));
|
html_output.append(wrap_string_in_style(JS::Value(&object).to_string_without_side_effects(), StyleType::Invalid));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue