diff --git a/Libraries/LibWebView/ViewImplementation.cpp b/Libraries/LibWebView/ViewImplementation.cpp index 22ec92214fc..98ec023e243 100644 --- a/Libraries/LibWebView/ViewImplementation.cpp +++ b/Libraries/LibWebView/ViewImplementation.cpp @@ -494,7 +494,7 @@ void ViewImplementation::handle_resize() client().async_set_viewport_size(page_id(), this->viewport_size()); } -void ViewImplementation::handle_web_content_process_crash() +void ViewImplementation::handle_web_content_process_crash(LoadErrorPage load_error_page) { dbgln("WebContent process crashed!"); dbgln("Consider raising an issue at https://github.com/LadybirdBrowser/ladybird/issues/new/choose"); @@ -515,19 +515,22 @@ void ViewImplementation::handle_web_content_process_crash() m_backup_bitmap = nullptr; handle_resize(); - StringBuilder builder; - builder.append("Crashed: "sv); - builder.append(escape_html_entities(m_url.to_byte_string())); - builder.append(""sv); - builder.append("

Web page crashed"sv); - if (!m_url.host().has()) { - builder.appendff(" on {}", escape_html_entities(m_url.serialized_host().release_value_but_fixme_should_propagate_errors())); + + if (load_error_page == LoadErrorPage::Yes) { + StringBuilder builder; + builder.append("Crashed: "sv); + builder.append(escape_html_entities(m_url.to_byte_string())); + builder.append(""sv); + builder.append("

Web page crashed"sv); + if (!m_url.host().has()) { + builder.appendff(" on {}", escape_html_entities(m_url.serialized_host().release_value_but_fixme_should_propagate_errors())); + } + builder.append("

"sv); + auto escaped_url = escape_html_entities(m_url.to_byte_string()); + builder.appendff("The web page {} has crashed.

You can reload the page to try again.", escaped_url, escaped_url); + builder.append(""sv); + load_html(builder.to_byte_string()); } - builder.append("

"sv); - auto escaped_url = escape_html_entities(m_url.to_byte_string()); - builder.appendff("The web page {} has crashed.

You can reload the page to try again.", escaped_url, escaped_url); - builder.append(""sv); - load_html(builder.to_byte_string()); } static ErrorOr save_screenshot(Gfx::ShareableBitmap const& bitmap) diff --git a/Libraries/LibWebView/ViewImplementation.h b/Libraries/LibWebView/ViewImplementation.h index 6c0481a6abc..b31d231fbb5 100644 --- a/Libraries/LibWebView/ViewImplementation.h +++ b/Libraries/LibWebView/ViewImplementation.h @@ -254,7 +254,11 @@ protected: }; virtual void initialize_client(CreateNewClient = CreateNewClient::Yes) { } - void handle_web_content_process_crash(); + enum class LoadErrorPage { + No, + Yes, + }; + void handle_web_content_process_crash(LoadErrorPage = LoadErrorPage::Yes); struct SharedBitmap { i32 id { -1 };