UI/Qt: Pass WebContentOptions to TaskManagerWindow constructor

Previously, the browser would crash when opening a task manager window
with the `--enable-qt-networking` flag set because we were passing the
default WebContentOptions to the underlying WebContentView.
This commit is contained in:
Tim Ledbetter 2024-07-10 14:28:01 +01:00 committed by Alexander Kalenik
parent 28b95e8ed0
commit 11039085d0
Notes: sideshowbarker 2024-07-17 07:35:03 +09:00
5 changed files with 8 additions and 8 deletions

View file

@ -77,10 +77,10 @@ ErrorOr<void> Application::initialize_image_decoder()
return {};
}
void Application::show_task_manager_window()
void Application::show_task_manager_window(WebContentOptions const& web_content_options)
{
if (!m_task_manager_window) {
m_task_manager_window = new TaskManagerWindow(nullptr);
m_task_manager_window = new TaskManagerWindow(nullptr, web_content_options);
}
m_task_manager_window->show();
m_task_manager_window->activateWindow();

View file

@ -33,7 +33,7 @@ public:
BrowserWindow& new_window(Vector<URL::URL> const& initial_urls, WebView::CookieJar&, WebContentOptions const&, StringView webdriver_content_ipc_path, bool allow_popups, Tab* parent_tab = nullptr, Optional<u64> page_index = {});
void show_task_manager_window();
void show_task_manager_window(WebContentOptions const&);
void close_task_manager_window();
BrowserWindow& active_window() { return *m_active_window; }

View file

@ -349,8 +349,8 @@ BrowserWindow::BrowserWindow(Vector<URL::URL> const& initial_urls, WebView::Cook
task_manager_action->setIcon(load_icon_from_uri("resource://icons/16x16/app-system-monitor.png"sv));
task_manager_action->setShortcuts({ QKeySequence("Ctrl+Shift+M") });
inspect_menu->addAction(task_manager_action);
QObject::connect(task_manager_action, &QAction::triggered, this, [] {
static_cast<Ladybird::Application*>(QApplication::instance())->show_task_manager_window();
QObject::connect(task_manager_action, &QAction::triggered, this, [&] {
static_cast<Ladybird::Application*>(QApplication::instance())->show_task_manager_window(m_web_content_options);
});
auto* debug_menu = m_hamburger_menu->addMenu("&Debug");

View file

@ -10,9 +10,9 @@
namespace Ladybird {
TaskManagerWindow::TaskManagerWindow(QWidget* parent)
TaskManagerWindow::TaskManagerWindow(QWidget* parent, WebContentOptions const& web_content_options)
: QWidget(parent, Qt::WindowFlags(Qt::WindowType::Window))
, m_web_view(new WebContentView(this, {}, {}))
, m_web_view(new WebContentView(this, web_content_options, {}))
{
setLayout(new QVBoxLayout);
layout()->addWidget(m_web_view);

View file

@ -16,7 +16,7 @@ class TaskManagerWindow : public QWidget {
Q_OBJECT
public:
explicit TaskManagerWindow(QWidget* parent);
TaskManagerWindow(QWidget* parent, WebContentOptions const&);
private:
virtual void showEvent(QShowEvent*) override;