diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp
index 0ae4253c80..05034f285c 100644
--- a/Userland/Libraries/LibWeb/HTML/Window.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Window.cpp
@@ -32,6 +32,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -828,11 +829,11 @@ String Window::name() const
void Window::set_name(String const& name)
{
// 1. If this's navigable is null, then return.
- if (!browsing_context())
+ if (!navigable())
return;
// 2. Set this's navigable's active session history entry's document state's navigable target name to the given value.
- browsing_context()->set_name(name);
+ navigable()->active_session_history_entry()->document_state->set_navigable_target_name(name);
}
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location