diff --git a/Libraries/LibURL/Pattern/PatternParser.cpp b/Libraries/LibURL/Pattern/PatternParser.cpp index 53e9539f638..844f46f2187 100644 --- a/Libraries/LibURL/Pattern/PatternParser.cpp +++ b/Libraries/LibURL/Pattern/PatternParser.cpp @@ -311,7 +311,7 @@ PatternErrorOr> PatternParser::parse(Utf8View const& input, Options prefix = char_token->value; // 3. If prefix is not the empty string and not options’s prefix code point: - if (!prefix.is_empty() && options.prefix_code_point.has_value() && prefix != String::from_code_point(*options.prefix_code_point)) { + if (!prefix.is_empty() && (!options.prefix_code_point.has_value() || prefix != String::from_code_point(*options.prefix_code_point))) { // 1. Append prefix to the end of parser’s pending fixed value. parser.m_pending_fixed_value.append(prefix); diff --git a/Tests/LibWeb/Text/expected/wpt-import/urlpattern/urlpattern.any.txt b/Tests/LibWeb/Text/expected/wpt-import/urlpattern/urlpattern.any.txt index 1b2d5cabebe..40426470caa 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/urlpattern/urlpattern.any.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/urlpattern/urlpattern.any.txt @@ -2,8 +2,8 @@ Harness status: OK Found 354 tests -352 Pass -2 Fail +353 Pass +1 Fail Pass Loading data... Pass Pattern: [{"pathname":"/foo/bar"}] Inputs: [{"pathname":"/foo/bar"}] Pass Pattern: [{"pathname":"/foo/bar"}] Inputs: [{"pathname":"/foo/ba"}] @@ -282,7 +282,7 @@ Pass Pattern: [{"hostname":"[*\\:1]"}] Inputs: [{"hostname":"[::ab:1]"}] Pass Pattern: [{"hostname":"*\\:1]"}] Inputs: undefined Pass Pattern: ["https://foo{{@}}example.com"] Inputs: ["https://foo@example.com"] Pass Pattern: ["https://foo{@example.com"] Inputs: ["https://foo@example.com"] -Fail Pattern: ["data\\:text/javascript,let x = 100/:tens?5;"] Inputs: ["data:text/javascript,let x = 100/5;"] +Pass Pattern: ["data\\:text/javascript,let x = 100/:tens?5;"] Inputs: ["data:text/javascript,let x = 100/5;"] Pass Pattern: [{"pathname":"/:id/:id"}] Inputs: undefined Pass Pattern: [{"pathname":"/foo","baseURL":""}] Inputs: undefined Pass Pattern: ["/foo",""] Inputs: undefined