From 4f6aa384348eb4205e0c042760ebf23e96ee8ffc Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 13 Jun 2021 20:08:36 +0100 Subject: [PATCH] LibJS: Don't repeat attributes in {Boolean,Symbol}Prototype --- Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp | 5 +++-- Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp b/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp index c10fc476e3..ee87423a75 100644 --- a/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/BooleanPrototype.cpp @@ -20,8 +20,9 @@ void BooleanPrototype::initialize(GlobalObject& global_object) { auto& vm = this->vm(); BooleanObject::initialize(global_object); - define_native_function(vm.names.toString, to_string, 0, Attribute::Writable | Attribute::Configurable); - define_native_function(vm.names.valueOf, value_of, 0, Attribute::Writable | Attribute::Configurable); + u8 attr = Attribute::Writable | Attribute::Configurable; + define_native_function(vm.names.toString, to_string, 0, attr); + define_native_function(vm.names.valueOf, value_of, 0, attr); } BooleanPrototype::~BooleanPrototype() diff --git a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp index a77dacf970..784a36c542 100644 --- a/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SymbolPrototype.cpp @@ -26,9 +26,10 @@ void SymbolPrototype::initialize(GlobalObject& global_object) { auto& vm = this->vm(); Object::initialize(global_object); + u8 attr = Attribute::Writable | Attribute::Configurable; + define_native_function(vm.names.toString, to_string, 0, attr); + define_native_function(vm.names.valueOf, value_of, 0, attr); define_native_property(vm.names.description, description_getter, {}, Attribute::Configurable); - define_native_function(vm.names.toString, to_string, 0, Attribute::Writable | Attribute::Configurable); - define_native_function(vm.names.valueOf, value_of, 0, Attribute::Writable | Attribute::Configurable); define_native_function(vm.well_known_symbol_to_primitive(), symbol_to_primitive, 1, Attribute::Configurable); // 20.4.3.6 Symbol.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag