diff --git a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp index 7f40aa072f2..55c67ae8f6b 100644 --- a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp +++ b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -123,8 +123,9 @@ ErrorOr WebSocket::establish_web_socket_connection(URL::URL& url_record, V { // FIXME: Integrate properly with FETCH as per https://fetch.spec.whatwg.org/#websocket-opening-handshake - auto& window = verify_cast(client.global_object()); - auto origin_string = window.associated_document().origin().serialize(); + auto* window_or_worker = dynamic_cast(&client.global_object()); + VERIFY(window_or_worker); + auto origin_string = MUST(window_or_worker->origin()).to_byte_string(); Vector protcol_byte_strings; for (auto const& protocol : protocols)