From 46bfced9ad0eaaba48f8f55a9dac292c956c0022 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Sat, 11 Jan 2025 22:54:57 +1300 Subject: [PATCH] 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. --- Libraries/LibURL/Pattern/Init.h | 27 +++++++++++++++++++++++++++ Libraries/LibURL/Pattern/Pattern.h | 22 ++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 Libraries/LibURL/Pattern/Init.h create mode 100644 Libraries/LibURL/Pattern/Pattern.h diff --git a/Libraries/LibURL/Pattern/Init.h b/Libraries/LibURL/Pattern/Init.h new file mode 100644 index 00000000000..19c0a4d2e6f --- /dev/null +++ b/Libraries/LibURL/Pattern/Init.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025, Shannon Booth + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include + +namespace URL::Pattern { + +// https://urlpattern.spec.whatwg.org/#dictdef-urlpatterninit +struct Init { + Optional protocol; + Optional username; + Optional password; + Optional hostname; + Optional port; + Optional pathname; + Optional search; + Optional hash; + Optional base_url; +}; + +} diff --git a/Libraries/LibURL/Pattern/Pattern.h b/Libraries/LibURL/Pattern/Pattern.h new file mode 100644 index 00000000000..7378517a920 --- /dev/null +++ b/Libraries/LibURL/Pattern/Pattern.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2025, Shannon Booth + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include + +namespace URL::Pattern { + +// https://urlpattern.spec.whatwg.org/#typedefdef-urlpatterninput +using Input = Variant; + +// https://urlpattern.spec.whatwg.org/#dictdef-urlpatternoptions +struct Options { + bool ignore_case { false }; +}; + +}