mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 22:17:43 +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:
parent
b00218715a
commit
4bd089616e
1 changed files with 4 additions and 0 deletions
|
@ -21,6 +21,8 @@ LocationObject::LocationObject(JS::GlobalObject& global_object)
|
||||||
|
|
||||||
void LocationObject::initialize(JS::GlobalObject& global_object)
|
void LocationObject::initialize(JS::GlobalObject& global_object)
|
||||||
{
|
{
|
||||||
|
auto& vm = global_object.vm();
|
||||||
|
|
||||||
Object::initialize(global_object);
|
Object::initialize(global_object);
|
||||||
u8 attr = JS::Attribute::Writable | JS::Attribute::Enumerable;
|
u8 attr = JS::Attribute::Writable | JS::Attribute::Enumerable;
|
||||||
define_native_accessor("href", href_getter, href_setter, attr);
|
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("reload", reload, 0, JS::Attribute::Enumerable);
|
||||||
define_native_function("replace", replace, 1, 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()
|
LocationObject::~LocationObject()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue