mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 09:39:39 +00:00
LibWebView: Make loading an error page after a crash optional
We won't need this in headless-browser (who isn't calling this helper yet).
This commit is contained in:
parent
956b279ae1
commit
d2151e444e
Notes:
github-actions[bot]
2024-11-12 14:27:13 +00:00
Author: https://github.com/trflynn89
Commit: d2151e444e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2300
Reviewed-by: https://github.com/tcl3 ✅
2 changed files with 21 additions and 14 deletions
|
@ -494,7 +494,7 @@ void ViewImplementation::handle_resize()
|
||||||
client().async_set_viewport_size(page_id(), this->viewport_size());
|
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("WebContent process crashed!");
|
||||||
dbgln("Consider raising an issue at https://github.com/LadybirdBrowser/ladybird/issues/new/choose");
|
dbgln("Consider raising an issue at https://github.com/LadybirdBrowser/ladybird/issues/new/choose");
|
||||||
|
@ -515,6 +515,8 @@ void ViewImplementation::handle_web_content_process_crash()
|
||||||
m_backup_bitmap = nullptr;
|
m_backup_bitmap = nullptr;
|
||||||
|
|
||||||
handle_resize();
|
handle_resize();
|
||||||
|
|
||||||
|
if (load_error_page == LoadErrorPage::Yes) {
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("<html><head><title>Crashed: "sv);
|
builder.append("<html><head><title>Crashed: "sv);
|
||||||
builder.append(escape_html_entities(m_url.to_byte_string()));
|
builder.append(escape_html_entities(m_url.to_byte_string()));
|
||||||
|
@ -529,6 +531,7 @@ void ViewImplementation::handle_web_content_process_crash()
|
||||||
builder.append("</body></html>"sv);
|
builder.append("</body></html>"sv);
|
||||||
load_html(builder.to_byte_string());
|
load_html(builder.to_byte_string());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static ErrorOr<LexicalPath> save_screenshot(Gfx::ShareableBitmap const& bitmap)
|
static ErrorOr<LexicalPath> save_screenshot(Gfx::ShareableBitmap const& bitmap)
|
||||||
{
|
{
|
||||||
|
|
|
@ -254,7 +254,11 @@ protected:
|
||||||
};
|
};
|
||||||
virtual void initialize_client(CreateNewClient = CreateNewClient::Yes) { }
|
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 {
|
struct SharedBitmap {
|
||||||
i32 id { -1 };
|
i32 id { -1 };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue