mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibXML: Allow empty systemid when parsing document type
This fixes at least one WPT under /domparsing
This commit is contained in:
parent
7372b2af48
commit
89192ecc46
Notes:
github-actions[bot]
2024-10-23 19:31:51 +00:00
Author: https://github.com/f-cramer 🔰 Commit: https://github.com/LadybirdBrowser/ladybird/commit/89192ecc465 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1897
4 changed files with 14 additions and 4 deletions
|
@ -0,0 +1 @@
|
|||
PASSED
|
|
@ -0,0 +1,9 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
var doc = new DOMParser().parseFromString('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ""><html><div id="test"/></html>', 'application/xhtml+xml');
|
||||
if (doc.getElementById('test')) {
|
||||
println('PASSED');
|
||||
}
|
||||
});
|
||||
</script>
|
|
@ -259,7 +259,7 @@ requires(IsCallableWithArguments<Pred, bool, char>) ErrorOr<StringView, ParseErr
|
|||
}
|
||||
|
||||
template<typename Pred>
|
||||
requires(IsCallableWithArguments<Pred, bool, char>) ErrorOr<StringView, ParseError> Parser::expect_many(Pred predicate, StringView description)
|
||||
requires(IsCallableWithArguments<Pred, bool, char>) ErrorOr<StringView, ParseError> Parser::expect_many(Pred predicate, StringView description, bool allow_empty)
|
||||
{
|
||||
auto rollback = rollback_point();
|
||||
auto start = m_lexer.tell();
|
||||
|
@ -269,7 +269,7 @@ requires(IsCallableWithArguments<Pred, bool, char>) ErrorOr<StringView, ParseErr
|
|||
m_lexer.ignore();
|
||||
}
|
||||
|
||||
if (m_lexer.tell() == start) {
|
||||
if (m_lexer.tell() == start && !allow_empty) {
|
||||
if (m_options.treat_errors_as_fatal) {
|
||||
return parse_error(m_lexer.current_position(), Expectation { description });
|
||||
}
|
||||
|
@ -1561,7 +1561,7 @@ ErrorOr<StringView, ParseError> Parser::parse_system_id_literal()
|
|||
auto quote = TRY(expect(is_any_of("'\""sv), "any of ' or \""sv));
|
||||
auto accept = accept_rule();
|
||||
|
||||
auto id = TRY(expect_many(is_not_any_of(quote), "not a quote"sv));
|
||||
auto id = TRY(expect_many(is_not_any_of(quote), "not a quote"sv, true));
|
||||
TRY(expect(quote));
|
||||
|
||||
rollback.disarm();
|
||||
|
|
|
@ -146,7 +146,7 @@ private:
|
|||
template<typename Pred>
|
||||
requires(IsCallableWithArguments<Pred, bool, char>) ErrorOr<StringView, ParseError> expect(Pred, StringView description);
|
||||
template<typename Pred>
|
||||
requires(IsCallableWithArguments<Pred, bool, char>) ErrorOr<StringView, ParseError> expect_many(Pred, StringView description);
|
||||
requires(IsCallableWithArguments<Pred, bool, char>) ErrorOr<StringView, ParseError> expect_many(Pred, StringView description, bool allow_empty = false);
|
||||
|
||||
static size_t s_debug_indent_level;
|
||||
[[nodiscard]] auto rollback_point(SourceLocation location = SourceLocation::current())
|
||||
|
|
Loading…
Reference in a new issue