mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-29 12:49:05 +00:00
LibXML: Don't emit a parser error for failing to resolve DTD URI
This prevented loading SVGs such as: https://mdn.github.io/learning-area/html/multimedia-and-embedding/mdn-splash-page-finished/mdn.svg Where the DTD is not in the hardcoded unified DTD in LibWeb. It also prevented loading any SVG with a broken link for a DTD, which other browsers just seem to ignore.
This commit is contained in:
parent
966b042db6
commit
d2f971a919
Notes:
sideshowbarker
2024-07-17 09:48:50 +09:00
Author: https://github.com/MacDue
Commit: d2f971a919
Pull-request: https://github.com/SerenityOS/serenity/pull/23767
1 changed files with 11 additions and 15 deletions
|
@ -568,16 +568,11 @@ ErrorOr<void, ParseError> Parser::parse_doctype_decl()
|
||||||
TRY(skip_whitespace(Required::Yes));
|
TRY(skip_whitespace(Required::Yes));
|
||||||
doctype.type = TRY(parse_name());
|
doctype.type = TRY(parse_name());
|
||||||
if (auto result = skip_whitespace(Required::Yes); !result.is_error()) {
|
if (auto result = skip_whitespace(Required::Yes); !result.is_error()) {
|
||||||
auto id_start = m_lexer.tell();
|
|
||||||
if (auto id_result = parse_external_id(); !id_result.is_error()) {
|
if (auto id_result = parse_external_id(); !id_result.is_error()) {
|
||||||
doctype.external_id = id_result.release_value();
|
doctype.external_id = id_result.release_value();
|
||||||
if (m_options.resolve_external_resource) {
|
if (m_options.resolve_external_resource) {
|
||||||
auto resource_result = m_options.resolve_external_resource(doctype.external_id->system_id, doctype.external_id->public_id);
|
auto resource_result = m_options.resolve_external_resource(doctype.external_id->system_id, doctype.external_id->public_id);
|
||||||
if (resource_result.is_error()) {
|
if (!resource_result.is_error()) {
|
||||||
return parse_error(
|
|
||||||
id_start,
|
|
||||||
ByteString::formatted("Failed to resolve external subset '{}': {}", doctype.external_id->system_id.system_literal, resource_result.error()));
|
|
||||||
}
|
|
||||||
StringView resolved_source = resource_result.value();
|
StringView resolved_source = resource_result.value();
|
||||||
TemporaryChange source { m_source, resolved_source };
|
TemporaryChange source { m_source, resolved_source };
|
||||||
TemporaryChange lexer { m_lexer, LineTrackingLexer(m_source) };
|
TemporaryChange lexer { m_lexer, LineTrackingLexer(m_source) };
|
||||||
|
@ -591,6 +586,7 @@ ErrorOr<void, ParseError> Parser::parse_doctype_decl()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
TRY(skip_whitespace(Required::No));
|
TRY(skip_whitespace(Required::No));
|
||||||
if (m_lexer.consume_specific('[')) {
|
if (m_lexer.consume_specific('[')) {
|
||||||
auto internal_subset = TRY(parse_internal_subset());
|
auto internal_subset = TRY(parse_internal_subset());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue