diff options
author | Andreas Kling <kling@serenityos.org> | 2020-06-06 14:06:37 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-06 14:14:43 +0200 |
commit | 71da52482c0b190898805bc20b3b0e138d8ad258 (patch) | |
tree | da501a0532efc879335d9121e649e9a5e51fa49a /Libraries | |
parent | f88146c7c9a4cfaede93713c0ddd2800a726e97d (diff) | |
download | serenity-71da52482c0b190898805bc20b3b0e138d8ad258.zip |
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.
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibWeb/Loader/FrameLoader.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Libraries/LibWeb/Loader/FrameLoader.cpp b/Libraries/LibWeb/Loader/FrameLoader.cpp index f855229698..afd595bfaf 100644 --- a/Libraries/LibWeb/Loader/FrameLoader.cpp +++ b/Libraries/LibWeb/Loader/FrameLoader.cpp @@ -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()) |