1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:17:44 +00:00

LibWeb: Allow configuring the default error page path

This commit is contained in:
DexesTTP 2022-04-03 18:01:10 +02:00 committed by Linus Groh
parent 26bb95425d
commit bf6c4835e6
2 changed files with 9 additions and 2 deletions

View file

@ -259,14 +259,20 @@ void FrameLoader::load_html(StringView html, const AK::URL& url)
browsing_context().set_active_document(&parser->document()); browsing_context().set_active_document(&parser->document());
} }
static String s_error_page_url = "file:///res/html/error.html";
void FrameLoader::set_error_page_url(String error_page_url)
{
s_error_page_url = error_page_url;
}
// FIXME: Use an actual templating engine (our own one when it's built, preferably // FIXME: Use an actual templating engine (our own one when it's built, preferably
// with a way to check these usages at compile time) // with a way to check these usages at compile time)
void FrameLoader::load_error_page(const AK::URL& failed_url, String const& error) void FrameLoader::load_error_page(const AK::URL& failed_url, String const& error)
{ {
auto error_page_url = "file:///res/html/error.html";
ResourceLoader::the().load( ResourceLoader::the().load(
error_page_url, s_error_page_url,
[this, failed_url, error](auto data, auto&, auto) { [this, failed_url, error](auto data, auto&, auto) {
VERIFY(!data.is_null()); VERIFY(!data.is_null());
StringBuilder builder; StringBuilder builder;

View file

@ -24,6 +24,7 @@ public:
}; };
static void set_default_favicon_path(String); static void set_default_favicon_path(String);
static void set_error_page_url(String);
explicit FrameLoader(HTML::BrowsingContext&); explicit FrameLoader(HTML::BrowsingContext&);
~FrameLoader(); ~FrameLoader();