diff options
author | Linus Groh <mail@linusgroh.de> | 2021-07-03 22:28:40 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-07-04 22:07:36 +0100 |
commit | 9fd9e424fff4287d3cf24aff622a5a475b7d555a (patch) | |
tree | 222e19efa31fe58cd64d74361c648fd7336c2f1e /Userland/Libraries/LibJS/MarkupGenerator.cpp | |
parent | f35c25a7eb331a4ee4252ffac82393e4cf36714f (diff) | |
download | serenity-9fd9e424fff4287d3cf24aff622a5a475b7d555a.zip |
LibJS: Avoid unnecessary PropertyName creation in MarkupGenerator
Diffstat (limited to 'Userland/Libraries/LibJS/MarkupGenerator.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/MarkupGenerator.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/MarkupGenerator.cpp b/Userland/Libraries/LibJS/MarkupGenerator.cpp index 0da123a3ff..7a6fe8f550 100644 --- a/Userland/Libraries/LibJS/MarkupGenerator.cpp +++ b/Userland/Libraries/LibJS/MarkupGenerator.cpp @@ -12,6 +12,7 @@ #include <LibJS/Runtime/Date.h> #include <LibJS/Runtime/Error.h> #include <LibJS/Runtime/Object.h> +#include <LibJS/Runtime/VM.h> 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*>&) { - auto name = object.get_without_side_effects(PropertyName("name")).value_or(JS::js_undefined()); - auto message = object.get_without_side_effects(PropertyName("message")).value_or(JS::js_undefined()); + auto& vm = object.vm(); + 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()) { html_output.append(wrap_string_in_style(JS::Value(&object).to_string_without_side_effects(), StyleType::Invalid)); } else { |