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

LibWeb: Basic support for location.replace(url)

This is not entirely to spec, but gets the basic job done.
This commit is contained in:
Andreas Kling 2021-10-03 23:31:52 +02:00
parent 37784a85c0
commit 573955be7f
4 changed files with 23 additions and 0 deletions

View file

@ -234,6 +234,15 @@ void Window::did_call_location_reload(Badge<Bindings::LocationObject>)
frame->loader().load(associated_document().url(), FrameLoader::Type::Reload);
}
void Window::did_call_location_replace(Badge<Bindings::LocationObject>, String url)
{
auto* frame = associated_document().browsing_context();
if (!frame)
return;
auto new_url = associated_document().parse_url(url);
frame->loader().load(move(new_url), FrameLoader::Type::Navigation);
}
bool Window::dispatch_event(NonnullRefPtr<Event> event)
{
return EventDispatcher::dispatch(*this, event, true);