mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-29 19:10:26 +00:00
LibJS: Add Array.prototype.@@unscopables
This commit is contained in:
parent
2d87d5dab9
commit
fc1168a3b3
Notes:
sideshowbarker
2024-07-18 12:16:09 +09:00
Author: https://github.com/davidot Commit: https://github.com/SerenityOS/serenity/commit/fc1168a3b3a Pull-request: https://github.com/SerenityOS/serenity/pull/8025 Reviewed-by: https://github.com/linusg
1 changed files with 17 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2020-2021, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2020, Marcin Gasperowicz <xnooga@gmail.com>
|
||||
* Copyright (c) 2021, David Tuin <david.tuin@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -72,6 +73,22 @@ void ArrayPrototype::initialize(GlobalObject& global_object)
|
|||
// evaluates to true
|
||||
// 23.1.3.33 Array.prototype [ @@iterator ] ( ), https://tc39.es/ecma262/#sec-array.prototype-@@iterator
|
||||
define_property(vm.well_known_symbol_iterator(), get(vm.names.values), attr);
|
||||
|
||||
// 23.1.3.34 Array.prototype [ @@unscopables ], https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
||||
Object* unscopable_list = create_empty(global_object);
|
||||
unscopable_list->set_prototype(nullptr);
|
||||
unscopable_list->put(vm.names.copyWithin, Value(true));
|
||||
unscopable_list->put(vm.names.entries, Value(true));
|
||||
unscopable_list->put(vm.names.fill, Value(true));
|
||||
unscopable_list->put(vm.names.find, Value(true));
|
||||
unscopable_list->put(vm.names.findIndex, Value(true));
|
||||
unscopable_list->put(vm.names.flat, Value(true));
|
||||
unscopable_list->put(vm.names.flatMap, Value(true));
|
||||
unscopable_list->put(vm.names.includes, Value(true));
|
||||
unscopable_list->put(vm.names.keys, Value(true));
|
||||
unscopable_list->put(vm.names.values, Value(true));
|
||||
|
||||
define_property(vm.well_known_symbol_unscopables(), unscopable_list, Attribute::Configurable);
|
||||
}
|
||||
|
||||
ArrayPrototype::~ArrayPrototype()
|
||||
|
|
Loading…
Reference in a new issue