LibWeb/LibURL: Use an IgnoreCase enum for URLPatternOptions

This is to save a future name conflict that will appear between
the options IDL dictionary and the options struct that are both
present in the spec.

It is also a nicer interface for now given there is only a single
option at the moment.
This commit is contained in:
Shannon Booth 2025-03-18 20:09:47 +13:00 committed by Tim Flynn
parent f80e7d6816
commit 8a33c57c1e
Notes: github-actions[bot] 2025-04-06 12:28:11 +00:00
4 changed files with 14 additions and 9 deletions

View file

@ -45,7 +45,7 @@ WebIDL::ExceptionOr<GC::Ref<URLPattern>> URLPattern::construct_impl(JS::Realm& r
WebIDL::ExceptionOr<GC::Ref<URLPattern>> URLPattern::create(JS::Realm& realm, URLPatternInput const& input, Optional<String> const& base_url, URLPatternOptions const& options)
{
// 1. Set thiss associated URL pattern to the result of create given input, baseURL, and options.
auto pattern_or_error = URL::Pattern::Pattern::create(input, base_url, options);
auto pattern_or_error = URL::Pattern::Pattern::create(input, base_url, options.ignore_case ? URL::Pattern::IgnoreCase::Yes : URL::Pattern::IgnoreCase::No);
if (pattern_or_error.is_error())
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, pattern_or_error.error().message };
return realm.create<URLPattern>(realm, pattern_or_error.release_value());