mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 14:47:35 +00:00
LibWebView+WebContent: Wait for dialog responses without blocking IPC
Currently, the WebContent process is completely blocked while waiting for a response to a dialog request. This patch allows the IPC event loop to continue executing while only blocking the HTML event loop. This will allow other processes like WebDriver to continue to operate on the WebContent process while a dialog is open.
This commit is contained in:
parent
4b8729aea6
commit
364f44d7d8
11 changed files with 118 additions and 32 deletions
|
@ -348,20 +348,22 @@ void OutOfProcessWebView::notify_server_did_request_image_context_menu(Badge<Web
|
|||
void OutOfProcessWebView::notify_server_did_request_alert(Badge<WebContentClient>, String const& message)
|
||||
{
|
||||
GUI::MessageBox::show(window(), message, "Alert"sv, GUI::MessageBox::Type::Information);
|
||||
client().async_alert_closed();
|
||||
}
|
||||
|
||||
bool OutOfProcessWebView::notify_server_did_request_confirm(Badge<WebContentClient>, String const& message)
|
||||
void OutOfProcessWebView::notify_server_did_request_confirm(Badge<WebContentClient>, String const& message)
|
||||
{
|
||||
auto confirm_result = GUI::MessageBox::show(window(), message, "Confirm"sv, GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel);
|
||||
return confirm_result == GUI::Dialog::ExecResult::OK;
|
||||
client().async_confirm_closed(confirm_result == GUI::Dialog::ExecResult::OK);
|
||||
}
|
||||
|
||||
String OutOfProcessWebView::notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_)
|
||||
void OutOfProcessWebView::notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_)
|
||||
{
|
||||
String response { default_ };
|
||||
if (GUI::InputBox::show(window(), response, message, "Prompt"sv) == GUI::InputBox::ExecResult::OK)
|
||||
return response;
|
||||
return {};
|
||||
client().async_prompt_closed(move(response));
|
||||
else
|
||||
client().async_prompt_closed({});
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::notify_server_did_get_source(const AK::URL& url, String const& source)
|
||||
|
|
|
@ -156,8 +156,8 @@ private:
|
|||
virtual void notify_server_did_request_link_context_menu(Badge<WebContentClient>, Gfx::IntPoint const&, const AK::URL&, String const& target, unsigned modifiers) override;
|
||||
virtual void notify_server_did_request_image_context_menu(Badge<WebContentClient>, Gfx::IntPoint const&, const AK::URL&, String const& target, unsigned modifiers, Gfx::ShareableBitmap const&) override;
|
||||
virtual void notify_server_did_request_alert(Badge<WebContentClient>, String const& message) override;
|
||||
virtual bool notify_server_did_request_confirm(Badge<WebContentClient>, String const& message) override;
|
||||
virtual String notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_) override;
|
||||
virtual void notify_server_did_request_confirm(Badge<WebContentClient>, String const& message) override;
|
||||
virtual void notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_) override;
|
||||
virtual void notify_server_did_get_source(const AK::URL& url, String const& source) override;
|
||||
virtual void notify_server_did_get_dom_tree(String const& dom_tree) override;
|
||||
virtual void notify_server_did_get_dom_node_properties(i32 node_id, String const& specified_style, String const& computed_style, String const& custom_properties, String const& node_box_sizing) override;
|
||||
|
|
|
@ -42,8 +42,8 @@ public:
|
|||
virtual void notify_server_did_request_link_context_menu(Badge<WebContentClient>, Gfx::IntPoint const&, const AK::URL&, String const& target, unsigned modifiers) = 0;
|
||||
virtual void notify_server_did_request_image_context_menu(Badge<WebContentClient>, Gfx::IntPoint const&, const AK::URL&, String const& target, unsigned modifiers, Gfx::ShareableBitmap const&) = 0;
|
||||
virtual void notify_server_did_request_alert(Badge<WebContentClient>, String const& message) = 0;
|
||||
virtual bool notify_server_did_request_confirm(Badge<WebContentClient>, String const& message) = 0;
|
||||
virtual String notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_) = 0;
|
||||
virtual void notify_server_did_request_confirm(Badge<WebContentClient>, String const& message) = 0;
|
||||
virtual void notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_) = 0;
|
||||
virtual void notify_server_did_get_source(const AK::URL& url, String const& source) = 0;
|
||||
virtual void notify_server_did_get_dom_tree(String const& dom_tree) = 0;
|
||||
virtual void notify_server_did_get_dom_node_properties(i32 node_id, String const& specified_style, String const& computed_style, String const& custom_properties, String const& node_box_sizing) = 0;
|
||||
|
|
|
@ -181,14 +181,14 @@ void WebContentClient::did_request_alert(String const& message)
|
|||
m_view.notify_server_did_request_alert({}, message);
|
||||
}
|
||||
|
||||
Messages::WebContentClient::DidRequestConfirmResponse WebContentClient::did_request_confirm(String const& message)
|
||||
void WebContentClient::did_request_confirm(String const& message)
|
||||
{
|
||||
return m_view.notify_server_did_request_confirm({}, message);
|
||||
m_view.notify_server_did_request_confirm({}, message);
|
||||
}
|
||||
|
||||
Messages::WebContentClient::DidRequestPromptResponse WebContentClient::did_request_prompt(String const& message, String const& default_)
|
||||
void WebContentClient::did_request_prompt(String const& message, String const& default_)
|
||||
{
|
||||
return m_view.notify_server_did_request_prompt({}, message, default_);
|
||||
m_view.notify_server_did_request_prompt({}, message, default_);
|
||||
}
|
||||
|
||||
void WebContentClient::did_change_favicon(Gfx::ShareableBitmap const& favicon)
|
||||
|
|
|
@ -58,8 +58,8 @@ private:
|
|||
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;
|
||||
virtual Messages::WebContentClient::DidRequestPromptResponse did_request_prompt(String const&, String const&) override;
|
||||
virtual void did_request_confirm(String const&) override;
|
||||
virtual void did_request_prompt(String const&, String const&) override;
|
||||
virtual Messages::WebContentClient::DidRequestAllCookiesResponse did_request_all_cookies(AK::URL const&) override;
|
||||
virtual Messages::WebContentClient::DidRequestNamedCookieResponse did_request_named_cookie(AK::URL const&, String const&) override;
|
||||
virtual Messages::WebContentClient::DidRequestCookieResponse did_request_cookie(AK::URL const&, u8) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue