mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:38:12 +00:00
LibWeb: Add resource_directory_url for internal HTML pages
The error.html page now uses the resource_directory_url this variable contains the relative path to /Base/res/ on the host system as a file:// url. This is needed for future pages to load resource files like icons. For the error.html page this was not really needed because it lies over this own URL in FrameLoader.cpp.
This commit is contained in:
parent
af01cf70eb
commit
e4c3a52cfa
4 changed files with 26 additions and 1 deletions
|
@ -169,8 +169,25 @@ void FrameLoader::load_html(StringView html, const AK::URL& url)
|
|||
parser->run(url);
|
||||
}
|
||||
|
||||
static DeprecatedString s_resource_directory_url = "file:///res";
|
||||
|
||||
DeprecatedString FrameLoader::resource_directory_url()
|
||||
{
|
||||
return s_resource_directory_url;
|
||||
}
|
||||
|
||||
void FrameLoader::set_resource_directory_url(DeprecatedString resource_directory_url)
|
||||
{
|
||||
s_resource_directory_url = resource_directory_url;
|
||||
}
|
||||
|
||||
static DeprecatedString s_error_page_url = "file:///res/html/error.html";
|
||||
|
||||
DeprecatedString FrameLoader::error_page_url()
|
||||
{
|
||||
return s_error_page_url;
|
||||
}
|
||||
|
||||
void FrameLoader::set_error_page_url(DeprecatedString error_page_url)
|
||||
{
|
||||
s_error_page_url = error_page_url;
|
||||
|
@ -189,6 +206,7 @@ void FrameLoader::load_error_page(const AK::URL& failed_url, DeprecatedString co
|
|||
VERIFY(!data.is_null());
|
||||
StringBuilder builder;
|
||||
SourceGenerator generator { builder };
|
||||
generator.set("resource_directory_url", resource_directory_url());
|
||||
generator.set("failed_url", escape_html_entities(failed_url.to_deprecated_string()));
|
||||
generator.set("error", escape_html_entities(error));
|
||||
generator.append(data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue