mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibJS: Implement Iterator.prototype [ @@toStringTag ]
This commit is contained in:
parent
d9d245faa7
commit
7ff6b472c0
Notes:
sideshowbarker
2024-07-17 05:01:20 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/7ff6b472c0 Pull-request: https://github.com/SerenityOS/serenity/pull/19642
2 changed files with 7 additions and 0 deletions
|
@ -20,6 +20,10 @@ ThrowCompletionOr<void> IteratorPrototype::initialize(Realm& realm)
|
|||
{
|
||||
auto& vm = this->vm();
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
|
||||
// 3.1.3.13 Iterator.prototype [ @@toStringTag ], https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype-@@tostringtag
|
||||
define_direct_property(vm.well_known_symbol_to_string_tag(), MUST_OR_THROW_OOM(PrimitiveString::create(vm, "Iterator"sv)), Attribute::Configurable | Attribute::Writable);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(realm, vm.well_known_symbol_iterator(), symbol_iterator, 0, attr);
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
test("basic functionality", () => {
|
||||
expect(Iterator.prototype[Symbol.toStringTag]).toBe("Iterator");
|
||||
});
|
Loading…
Reference in a new issue