LibWeb: Show error page if we can't handle a frame's main resource

If we can't figure out how to make a Document for the main resource
in a Frame, just show an error page.
This commit is contained in:
Andreas Kling 2020-06-06 14:06:37 +02:00
parent f88146c7c9
commit 71da52482c
Notes: sideshowbarker 2024-07-19 05:48:20 +09:00

View File

@ -221,7 +221,12 @@ void FrameLoader::resource_did_load()
dbg() << "I believe this content has MIME type '" << resource()->mime_type() << "', encoding '" << resource()->encoding() << "'";
auto document = create_document_from_mime_type(resource()->encoded_data(), url, resource()->mime_type(), resource()->encoding());
ASSERT(document);
if (!document) {
load_error_page(url, "Failed to parse content.");
return;
}
frame().set_document(document);
if (!url.fragment().is_empty())