1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 05:35:06 +00:00

LibWeb+WebContent: Add new console-message IPC calls

This patch introduces three new IPC calls for WebContent:

- `Client::did_output_js_console_message(index)`:
  Notifies the client that a new console message was logged.

- `Server::js_console_request_messages(start_index)`:
  Ask the server for console messages starting at the given index.

- `Client::did_get_js_console_messages(start_index, types, messages)`:
  Send the client the messages they requested.

This mechanism will replace the current
`Client::did_js_console_output()` call in the next few commits. This
will allow us to display messages in the console that happened before
the console was opened.
This commit is contained in:
Sam Atkins 2021-09-04 11:14:25 +01:00 committed by Andreas Kling
parent 5220d6d2e5
commit c619a57cf8
9 changed files with 61 additions and 0 deletions

View file

@ -353,6 +353,18 @@ void OutOfProcessWebView::notify_server_did_js_console_output(const String& meth
on_js_console_output(method, line);
}
void OutOfProcessWebView::notify_server_did_output_js_console_message(i32 message_index)
{
if (on_js_console_new_message)
on_js_console_new_message(message_index);
}
void OutOfProcessWebView::notify_server_did_get_js_console_messages(i32 start_index, const Vector<String>& message_types, const Vector<String>& messages)
{
if (on_get_js_console_messages)
on_get_js_console_messages(start_index, message_types, messages);
}
void OutOfProcessWebView::notify_server_did_change_favicon(const Gfx::Bitmap& favicon)
{
if (on_favicon_change)
@ -439,6 +451,11 @@ void OutOfProcessWebView::js_console_input(const String& js_source)
client().async_js_console_input(js_source);
}
void OutOfProcessWebView::js_console_request_messages(i32 start_index)
{
client().async_js_console_request_messages(start_index);
}
void OutOfProcessWebView::run_javascript(StringView js_source)
{
client().async_run_javascript(js_source);