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
Notes: sideshowbarker 2024-07-17 10:35:15 +09:00
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());
}
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
// with a way to check these usages at compile time)
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(
error_page_url,
s_error_page_url,
[this, failed_url, error](auto data, auto&, auto) {
VERIFY(!data.is_null());
StringBuilder builder;

View file

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