mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +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
|
@ -283,6 +283,18 @@ void ClientConnection::js_console_initialize()
|
|||
}
|
||||
}
|
||||
|
||||
void ClientConnection::initialize_js_console(Badge<PageHost>)
|
||||
{
|
||||
auto* document = page().top_level_browsing_context().document();
|
||||
auto interpreter = document->interpreter().make_weak_ptr();
|
||||
if (m_interpreter.ptr() == interpreter.ptr())
|
||||
return;
|
||||
|
||||
m_interpreter = interpreter;
|
||||
m_console_client = make<WebContentConsoleClient>(interpreter->global_object().console(), interpreter, *this);
|
||||
interpreter->global_object().console().set_client(*m_console_client.ptr());
|
||||
}
|
||||
|
||||
void ClientConnection::js_console_input(const String& js_source)
|
||||
{
|
||||
if (m_console_client)
|
||||
|
@ -306,6 +318,11 @@ void ClientConnection::run_javascript(String const& js_source)
|
|||
}
|
||||
}
|
||||
|
||||
void ClientConnection::js_console_request_messages(i32)
|
||||
{
|
||||
TODO();
|
||||
}
|
||||
|
||||
Messages::WebContentServer::GetSelectedTextResponse ClientConnection::get_selected_text()
|
||||
{
|
||||
return page().focused_context().selected_text();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue