mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-29 08:11:13 +00:00
LibXML: Actually append resolved references when parsing content
This commit is contained in:
parent
f25745ed27
commit
2f7527b0a4
Notes:
sideshowbarker
2024-07-17 22:41:14 +09:00
Author: https://github.com/DanShaders Commit: https://github.com/SerenityOS/serenity/commit/2f7527b0a4 Pull-request: https://github.com/SerenityOS/serenity/pull/20154
|
@ -29,3 +29,15 @@ TEST_CASE(character_reference_integer_overflow)
|
||||||
return Test::Crash::Failure::DidNotCrash;
|
return Test::Crash::Failure::DidNotCrash;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE(predefined_character_reference)
|
||||||
|
{
|
||||||
|
XML::Parser parser("<a>Well hello &, <, >, ', and "!</a>"sv);
|
||||||
|
auto document = MUST(parser.parse());
|
||||||
|
|
||||||
|
auto const& node = document.root().content.get<XML::Node::Element>();
|
||||||
|
EXPECT_EQ(node.name, "a");
|
||||||
|
|
||||||
|
auto const& content = node.children[0]->content.get<XML::Node::Text>();
|
||||||
|
EXPECT_EQ(content.builder.string_view(), "Well hello &, <, >, ', and \"!");
|
||||||
|
}
|
||||||
|
|
|
@ -862,7 +862,7 @@ ErrorOr<void, ParseError> Parser::parse_content()
|
||||||
if (auto char_reference = reference.get_pointer<DeprecatedString>())
|
if (auto char_reference = reference.get_pointer<DeprecatedString>())
|
||||||
append_text(*char_reference);
|
append_text(*char_reference);
|
||||||
else
|
else
|
||||||
TRY(resolve_reference(reference.get<EntityReference>(), ReferencePlacement::Content));
|
append_text(TRY(resolve_reference(reference.get<EntityReference>(), ReferencePlacement::Content)));
|
||||||
goto try_char_data;
|
goto try_char_data;
|
||||||
}
|
}
|
||||||
if (auto result = parse_cdata_section(); !result.is_error()) {
|
if (auto result = parse_cdata_section(); !result.is_error()) {
|
||||||
|
|
Loading…
Reference in a new issue