From f2b423ebc334fc302702e830141ebf46220f5ead Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Fri, 3 Jan 2025 12:53:30 -0500 Subject: [PATCH] fix a boolean operation --- src/parser.cpp | 5 ++--- src/url_pattern.cpp | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/parser.cpp b/src/parser.cpp index 79b3fa42f..09c6ad283 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -940,9 +940,8 @@ tl::expected 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()); diff --git a/src/url_pattern.cpp b/src/url_pattern.cpp index 92b894926..3eaa19f22 100644 --- a/src/url_pattern.cpp +++ b/src/url_pattern.cpp @@ -120,8 +120,7 @@ tl::expected 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();