mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +00:00
LibURL: Remove the implicit URL constructors
All URLs are now either constucted through the URL Parser or by default constructing a URL, and setting each of the fields of that URL manually. This makes it much more difficult to create invalid URLs.
This commit is contained in:
parent
1a47cfe3b9
commit
de89f5af6d
Notes:
github-actions[bot]
2025-03-04 21:25:54 +00:00
Author: https://github.com/shannonbooth
Commit: de89f5af6d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3668
Reviewed-by: https://github.com/trflynn89
2 changed files with 2 additions and 22 deletions
|
@ -2,6 +2,7 @@
|
|||
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2021, Max Wipfli <mail@maxwipfli.ch>
|
||||
* Copyright (c) 2024, Sam Atkins <sam@ladybird.org>
|
||||
* Copyright (c) 2023-2025, Shannon Booth <shannon@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -21,18 +22,6 @@
|
|||
|
||||
namespace URL {
|
||||
|
||||
// FIXME: It could make sense to force users of URL to use URL::Parser::basic_parse() explicitly instead of using a constructor.
|
||||
URL::URL(StringView string)
|
||||
: URL(Parser::basic_parse(string).value_or(URL {}))
|
||||
{
|
||||
if constexpr (URL_PARSER_DEBUG) {
|
||||
if (m_data->valid)
|
||||
dbgln("URL constructor: Parsed URL to be '{}'.", serialize());
|
||||
else
|
||||
dbgln("URL constructor: Parsed URL to be invalid.");
|
||||
}
|
||||
}
|
||||
|
||||
Optional<URL> URL::complete_url(StringView relative_url) const
|
||||
{
|
||||
if (!is_valid())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue