diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp
index 36a4cf19bf..3ca0fbdf5a 100644
--- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp
+++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp
@@ -52,31 +52,38 @@ OutOfProcessWebView::~OutOfProcessWebView()
{
}
+void OutOfProcessWebView::handle_web_content_process_crash()
+{
+ create_client();
+ ASSERT(m_client_state.client);
+
+ // Don't keep a stale backup bitmap around.
+ m_backup_bitmap = nullptr;
+
+ handle_resize();
+ StringBuilder builder;
+ builder.append("
Crashed: ");
+ builder.append(escape_html_entities(m_url.to_string()));
+ builder.append("");
+ builder.append("Web page crashed");
+ if (!m_url.host().is_empty()) {
+ builder.appendff(" on {}", escape_html_entities(m_url.host()));
+ }
+ builder.append("
");
+ builder.appendff("The web page {} has crashed.
You can reload the page to try again.", escape_html_entities(m_url.to_string_encoded()), escape_html_entities(m_url.to_string()));
+ builder.append("");
+ load_html(builder.to_string(), m_url);
+}
+
void OutOfProcessWebView::create_client()
{
m_client_state = {};
m_client_state.client = WebContentClient::construct(*this);
m_client_state.client->on_web_content_process_crash = [this] {
- create_client();
- ASSERT(m_client_state.client);
-
- // Don't keep a stale backup bitmap around.
- m_backup_bitmap = nullptr;
-
- handle_resize();
- StringBuilder builder;
- builder.append("Crashed: ");
- builder.append(escape_html_entities(m_url.to_string()));
- builder.append("");
- builder.append("Web page crashed");
- if (!m_url.host().is_empty()) {
- builder.appendff(" on {}", escape_html_entities(m_url.host()));
- }
- builder.append("
");
- builder.appendff("The web page {} has crashed.
You can reload the page to try again.", escape_html_entities(m_url.to_string_encoded()), escape_html_entities(m_url.to_string()));
- builder.append("");
- load_html(builder.to_string(), m_url);
+ deferred_invoke([this] {
+ handle_web_content_process_crash();
+ });
};
client().post_message(Messages::WebContentServer::UpdateSystemTheme(Gfx::current_system_theme_buffer()));
diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.h b/Userland/Libraries/LibWeb/OutOfProcessWebView.h
index 5ca5bdd720..890860babe 100644
--- a/Userland/Libraries/LibWeb/OutOfProcessWebView.h
+++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.h
@@ -90,6 +90,8 @@ private:
void create_client();
WebContentClient& client();
+ void handle_web_content_process_crash();
+
URL m_url;
struct ClientState {