LibURL: Add representations of URLPattern{Init,Options,Input}

The URLPattern spec is intended to be implemented inside of LibURL, with
LibWeb only responsible for the IDL conversion layer, in a similar
manner to how URL is implemented.
This commit is contained in:
Shannon Booth 2025-01-11 22:54:57 +13:00 committed by Sam Atkins
parent 05351dfe45
commit 46bfced9ad
Notes: github-actions[bot] 2025-01-27 18:08:26 +00:00
2 changed files with 49 additions and 0 deletions

View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2025, Shannon Booth <shannon@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Optional.h>
#include <AK/String.h>
namespace URL::Pattern {
// https://urlpattern.spec.whatwg.org/#dictdef-urlpatterninit
struct Init {
Optional<String> protocol;
Optional<String> username;
Optional<String> password;
Optional<String> hostname;
Optional<String> port;
Optional<String> pathname;
Optional<String> search;
Optional<String> hash;
Optional<String> base_url;
};
}

View file

@ -0,0 +1,22 @@
/*
* Copyright (c) 2025, Shannon Booth <shannon@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Variant.h>
#include <LibURL/Pattern/Init.h>
namespace URL::Pattern {
// https://urlpattern.spec.whatwg.org/#typedefdef-urlpatterninput
using Input = Variant<String, Init>;
// https://urlpattern.spec.whatwg.org/#dictdef-urlpatternoptions
struct Options {
bool ignore_case { false };
};
}