1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +00:00

LibWeb: Implement window.location's stringifier

The location IDL interface includes a stringifier on the href
attribute i.e. the object's toString should return the value of the
href attribute.
This commit is contained in:
Idan Horowitz 2021-10-04 20:39:17 +03:00 committed by Linus Groh
parent b00218715a
commit 4bd089616e

View file

@ -21,6 +21,8 @@ LocationObject::LocationObject(JS::GlobalObject& global_object)
void LocationObject::initialize(JS::GlobalObject& global_object)
{
auto& vm = global_object.vm();
Object::initialize(global_object);
u8 attr = JS::Attribute::Writable | JS::Attribute::Enumerable;
define_native_accessor("href", href_getter, href_setter, attr);
@ -34,6 +36,8 @@ void LocationObject::initialize(JS::GlobalObject& global_object)
define_native_function("reload", reload, 0, JS::Attribute::Enumerable);
define_native_function("replace", replace, 1, JS::Attribute::Enumerable);
define_native_function(vm.names.toString, href_getter, 0, JS::Attribute::Enumerable);
}
LocationObject::~LocationObject()