Skip to content

Commit

Permalink
fix a boolean operation
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Jan 3, 2025
1 parent 223cf5d commit f2b423e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -940,9 +940,8 @@ tl::expected<url_pattern, errors> parse_url_pattern_impl(

// Let processedInit be the result of process a URLPatternInit given init,
// "pattern", null, null, null, null, null, null, null, and null.
auto processed_init = url_pattern_init::process(
init, "pattern", std::nullopt, std::nullopt, std::nullopt, std::nullopt,
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
// TODO: Make "pattern" an enum to avoid creating a string everytime.
auto processed_init = url_pattern_init::process(init, "pattern");
if (!processed_init) {
ada_log("url_pattern_init::process failed for init and 'pattern'");
return tl::unexpected(processed_init.error());
Expand Down
3 changes: 1 addition & 2 deletions src/url_pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ tl::expected<url_pattern_init, errors> url_pattern_init::process(
}

// If init contains neither "protocol" nor "hostname", then:
if (!init.protocol || !init.hostname) {
ADA_ASSERT_TRUE(base_url.has_value());
if (!init.protocol && !init.hostname) {
// Let baseHost be baseURL’s host.
// If baseHost is null, then set baseHost to the empty string.
auto base_host = base_url->get_hostname();
Expand Down

0 comments on commit f2b423e

Please sign in to comment.