LibJS: Implement ShadowRealm.prototype[@@toStringTag]

This commit is contained in:
Linus Groh 2021-10-13 21:10:22 +01:00
parent d40331ef69
commit b0ee7f38d0
2 changed files with 7 additions and 0 deletions

View file

@ -17,7 +17,11 @@ ShadowRealmPrototype::ShadowRealmPrototype(GlobalObject& global_object)
void ShadowRealmPrototype::initialize(GlobalObject& global_object)
{
auto& vm = this->vm();
Object::initialize(global_object);
// 3.4.3 ShadowRealm.prototype [ @@toStringTag ], https://tc39.es/proposal-shadowrealm/#sec-shadowrealm.prototype-@@tostringtag
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.ShadowRealm.as_string()), Attribute::Configurable);
}
}

View file

@ -0,0 +1,3 @@
test("basic functionality", () => {
expect(ShadowRealm.prototype[Symbol.toStringTag]).toBe("ShadowRealm");
});