From 6590b8a1a77307a64c04a1d4709112fe9d144e08 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sun, 27 Oct 2024 13:58:38 -0400 Subject: [PATCH] headless-browser: Send a dummy screen rect to WebContent The window.open spec assumes the User Agent knows its screen size. Send a fake screen from headless-browser to WebContent. --- Ladybird/Headless/HeadlessWebView.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Ladybird/Headless/HeadlessWebView.cpp b/Ladybird/Headless/HeadlessWebView.cpp index aa8309598fe..8c3c1a2639d 100644 --- a/Ladybird/Headless/HeadlessWebView.cpp +++ b/Ladybird/Headless/HeadlessWebView.cpp @@ -75,6 +75,9 @@ void HeadlessWebView::initialize_client(CreateNewClient create_new_client) client().async_set_viewport_size(m_client_state.page_index, viewport_size()); client().async_set_window_size(m_client_state.page_index, viewport_size()); + Vector screen_rects { Web::DevicePixelRect { 0, 0, 1920, 1080 } }; + client().async_update_screen_rects(m_client_state.page_index, move(screen_rects), 0); + if (Application::chrome_options().allow_popups == WebView::AllowPopups::Yes) client().async_debug_request(m_client_state.page_index, "block-pop-ups"sv, "off"sv);