mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:07:34 +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:
parent
5220d6d2e5
commit
c619a57cf8
9 changed files with 61 additions and 0 deletions
|
@ -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);
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
|
||||
void js_console_initialize();
|
||||
void js_console_input(const String& js_source);
|
||||
void js_console_request_messages(i32 start_index);
|
||||
|
||||
void run_javascript(StringView);
|
||||
|
||||
|
@ -75,6 +76,8 @@ public:
|
|||
void notify_server_did_get_dom_tree(const String& dom_tree);
|
||||
void notify_server_did_get_dom_node_properties(i32 node_id, String const& specified_style, String const& computed_style);
|
||||
void notify_server_did_js_console_output(const String& method, const String& line);
|
||||
void notify_server_did_output_js_console_message(i32 message_index);
|
||||
void notify_server_did_get_js_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages);
|
||||
void notify_server_did_change_favicon(const Gfx::Bitmap& favicon);
|
||||
String notify_server_did_request_cookie(Badge<WebContentClient>, const URL& url, Cookie::Source source);
|
||||
void notify_server_did_set_cookie(Badge<WebContentClient>, const URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source);
|
||||
|
|
|
@ -151,6 +151,16 @@ void WebContentClient::did_js_console_output(String const& method, String const&
|
|||
m_view.notify_server_did_js_console_output(method, line);
|
||||
}
|
||||
|
||||
void WebContentClient::did_output_js_console_message(i32 message_index)
|
||||
{
|
||||
m_view.notify_server_did_output_js_console_message(message_index);
|
||||
}
|
||||
|
||||
void WebContentClient::did_get_js_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)
|
||||
{
|
||||
m_view.notify_server_did_get_js_console_messages(start_index, message_types, messages);
|
||||
}
|
||||
|
||||
void WebContentClient::did_request_alert(String const& message)
|
||||
{
|
||||
m_view.notify_server_did_request_alert({}, message);
|
||||
|
|
|
@ -52,6 +52,8 @@ private:
|
|||
virtual void did_get_dom_tree(String const&) override;
|
||||
virtual void did_get_dom_node_properties(i32 node_id, String const& specified_style, String const& computed_style) override;
|
||||
virtual void did_js_console_output(String const&, String const&) override;
|
||||
virtual void did_output_js_console_message(i32 message_index) override;
|
||||
virtual void did_get_js_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages) override;
|
||||
virtual void did_change_favicon(Gfx::ShareableBitmap const&) override;
|
||||
virtual void did_request_alert(String const&) override;
|
||||
virtual Messages::WebContentClient::DidRequestConfirmResponse did_request_confirm(String const&) override;
|
||||
|
|
|
@ -30,6 +30,8 @@ public:
|
|||
Function<void(const String&)> on_get_dom_tree;
|
||||
Function<void(i32 node_id, String const& specified_style, String const& computed_style)> on_get_dom_node_properties;
|
||||
Function<void(const String& method, const String& line)> on_js_console_output;
|
||||
Function<void(i32 message_id)> on_js_console_new_message;
|
||||
Function<void(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)> on_get_js_console_messages;
|
||||
Function<String(const URL& url, Cookie::Source source)> on_get_cookie;
|
||||
Function<void(const URL& url, const Cookie::ParsedCookie& cookie, Cookie::Source source)> on_set_cookie;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue