Skip to content

Commit

Permalink
LibWeb/URLPattern: Add a stub for URLPattern.exec
Browse files Browse the repository at this point in the history
Just enough to get the IDL compiling :^)
  • Loading branch information
shannonbooth committed Jan 19, 2025
1 parent ebaf115 commit 120c201
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Libraries/LibWeb/URLPattern/URLPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,11 @@ WebIDL::ExceptionOr<GC::Ref<URLPattern>> URLPattern::construct_impl(JS::Realm& r
return realm.create<URLPattern>(realm);
}

// https://urlpattern.spec.whatwg.org/#dom-urlpattern-exec
Optional<URLPatternResult> URLPattern::exec(URLPatternInput const&, Optional<String> const&) const
{
dbgln("FIXME: Implement URLPattern::match");
return {};
}

}
3 changes: 3 additions & 0 deletions Libraries/LibWeb/URLPattern/URLPattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Web::URLPattern {
using URLPatternInit = URL::Pattern::Init;
using URLPatternInput = URL::Pattern::Input;
using URLPatternOptions = URL::Pattern::Options;
using URLPatternResult = URL::Pattern::Result;

// https://urlpattern.spec.whatwg.org/#urlpattern
class URLPattern : public Bindings::PlatformObject {
Expand All @@ -26,6 +27,8 @@ class URLPattern : public Bindings::PlatformObject {
static WebIDL::ExceptionOr<GC::Ref<URLPattern>> construct_impl(JS::Realm&, URLPatternInput const&, String const& base_url, URLPatternOptions const& = {});
static WebIDL::ExceptionOr<GC::Ref<URLPattern>> construct_impl(JS::Realm&, URLPatternInput const&, URLPatternOptions const& = {});

Optional<URLPatternResult> exec(URLPatternInput const&, Optional<String> const&) const;

virtual ~URLPattern() override;

protected:
Expand Down
2 changes: 1 addition & 1 deletion Libraries/LibWeb/URLPattern/URLPattern.idl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface URLPattern {

[FIXME] boolean test(optional URLPatternInput input = {}, optional USVString baseURL);

[FIXME] URLPatternResult? exec(optional URLPatternInput input = {}, optional USVString baseURL);
URLPatternResult? exec(optional URLPatternInput input = {}, optional USVString baseURL);

[FIXME] readonly attribute USVString protocol;
[FIXME] readonly attribute USVString username;
Expand Down

0 comments on commit 120c201

Please sign in to comment.