LibWebView+UI: Do not create a QApplication in headless mode

This is causing errors on the WPT runner, which does not have a display
output. To do this requires shuffling around the Main::Arguments struct,
as we now need access to it from overridden WebView::Application methods
after construction.
This commit is contained in:
Timothy Flynn 2025-06-10 14:56:24 -04:00 committed by Tim Ledbetter
commit fa164083fd
Notes: github-actions[bot] 2025-06-10 22:11:59 +00:00
6 changed files with 64 additions and 49 deletions

View file

@ -15,17 +15,12 @@
namespace Ladybird {
class Application
: public QApplication
, public WebView::Application {
Q_OBJECT
class Application : public WebView::Application {
WEB_VIEW_APPLICATION(Application)
public:
virtual ~Application() override;
virtual bool event(QEvent* event) override;
Function<void(URL::URL)> on_open_file;
BrowserWindow& new_window(Vector<URL::URL> const& initial_urls, BrowserWindow::IsPopupWindow is_popup_window = BrowserWindow::IsPopupWindow::No, Tab* parent_tab = nullptr, Optional<u64> page_index = {});
@ -39,6 +34,7 @@ private:
virtual Optional<ByteString> ask_user_for_download_folder() const override;
OwnPtr<QApplication> m_application;
BrowserWindow* m_active_window { nullptr };
};