mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 12:55:09 +00:00
LibWeb: Allow navigating to a new URL by setting window.location.href
This commit is contained in:
parent
1ec4db04cd
commit
efdfdbabdb
5 changed files with 32 additions and 3 deletions
|
@ -54,9 +54,13 @@ JS::Value LocationObject::href_getter(JS::Interpreter& interpreter)
|
|||
return JS::js_string(interpreter, window.impl().document().url().to_string());
|
||||
}
|
||||
|
||||
void LocationObject::href_setter(JS::Interpreter&, JS::Value)
|
||||
void LocationObject::href_setter(JS::Interpreter& interpreter, JS::Value value)
|
||||
{
|
||||
// FIXME: Navigate to a new URL
|
||||
auto& window = static_cast<WindowObject&>(interpreter.global_object());
|
||||
auto new_href = value.to_string(interpreter);
|
||||
if (interpreter.exception())
|
||||
return;
|
||||
window.impl().did_set_location_href({}, new_href);
|
||||
}
|
||||
|
||||
JS::Value LocationObject::pathname_getter(JS::Interpreter& interpreter)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue