mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:14:58 +00:00
Ladybird+LibWebView: Extract common JS console functionality to a helper
This creates WebView::ConsoleClient to handle functionality that will be common to the JS consoles of all Ladybird chromes. This will let each chrome focus on just the UI. Note that this includes the `console.group` functionality that only the Serenity chrome previously had. This was a FIXME in the Qt chrome, and it is implemented such that all chromes will receive this functionality for free.
This commit is contained in:
parent
c9b9278092
commit
bf59e06d2a
11 changed files with 300 additions and 366 deletions
|
@ -272,16 +272,6 @@ Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::
|
|||
m_inspector_widget->set_accessibility_json(accessibility_tree);
|
||||
};
|
||||
|
||||
view().on_received_console_message = [this](auto message_index) {
|
||||
if (m_console_widget)
|
||||
m_console_widget->notify_about_new_console_message(message_index);
|
||||
};
|
||||
|
||||
view().on_received_console_messages = [this](auto start_index, auto& message_types, auto& messages) {
|
||||
if (m_console_widget)
|
||||
m_console_widget->handle_console_messages(start_index, message_types, messages);
|
||||
};
|
||||
|
||||
auto* take_visible_screenshot_action = new QAction("Take &Visible Screenshot", this);
|
||||
take_visible_screenshot_action->setIcon(QIcon(QString("%1/res/icons/16x16/filetype-image.png").arg(s_serenity_resource_root.characters())));
|
||||
QObject::connect(take_visible_screenshot_action, &QAction::triggered, this, [this]() {
|
||||
|
@ -702,7 +692,7 @@ void Tab::show_inspector_window(InspectorTarget inspector_target)
|
|||
void Tab::show_console_window()
|
||||
{
|
||||
if (!m_console_widget) {
|
||||
m_console_widget = new Ladybird::ConsoleWidget;
|
||||
m_console_widget = new Ladybird::ConsoleWidget(view());
|
||||
m_console_widget->setWindowTitle("JS Console");
|
||||
m_console_widget->resize(640, 480);
|
||||
|
||||
|
@ -719,12 +709,6 @@ void Tab::show_console_window()
|
|||
auto screen_position = QCursor::pos();
|
||||
m_console_context_menu->exec(screen_position);
|
||||
};
|
||||
m_console_widget->on_js_input = [this](auto js_source) {
|
||||
view().js_console_input(js_source);
|
||||
};
|
||||
m_console_widget->on_request_messages = [this](i32 start_index) {
|
||||
view().js_console_request_messages(start_index);
|
||||
};
|
||||
}
|
||||
|
||||
m_console_widget->show();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue