Skip to content

Commit 1aa99ef

Browse files
authored
Ada 2.9.1, ada-python 1.15.1 (#91)
* Update WPT tests (2024-08-26) * Update to ada 2.9.1 * Bump version to 1.15.1
1 parent 58c8012 commit 1aa99ef

File tree

4 files changed

+261
-44
lines changed

4 files changed

+261
-44
lines changed

ada_url/ada.cpp

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on 2024-07-06 17:38:56 -0400. Do not edit! */
1+
/* auto-generated on 2024-08-24 20:20:43 -0400. Do not edit! */
22
/* begin file src/ada.cpp */
33
#include "ada.h"
44
/* begin file src/checkers.cpp */
@@ -13830,7 +13830,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
1383013830
return "null";
1383113831
}
1383213832

13833-
[[nodiscard]] std::string_view url_aggregator::get_username() const noexcept {
13833+
[[nodiscard]] std::string_view url_aggregator::get_username() const noexcept
13834+
ada_lifetime_bound {
1383413835
ada_log("url_aggregator::get_username");
1383513836
if (has_non_empty_username()) {
1383613837
return helpers::substring(buffer, components.protocol_end + 2,
@@ -13839,7 +13840,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
1383913840
return "";
1384013841
}
1384113842

13842-
[[nodiscard]] std::string_view url_aggregator::get_password() const noexcept {
13843+
[[nodiscard]] std::string_view url_aggregator::get_password() const noexcept
13844+
ada_lifetime_bound {
1384313845
ada_log("url_aggregator::get_password");
1384413846
if (has_non_empty_password()) {
1384513847
return helpers::substring(buffer, components.username_end + 1,
@@ -13848,7 +13850,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
1384813850
return "";
1384913851
}
1385013852

13851-
[[nodiscard]] std::string_view url_aggregator::get_port() const noexcept {
13853+
[[nodiscard]] std::string_view url_aggregator::get_port() const noexcept
13854+
ada_lifetime_bound {
1385213855
ada_log("url_aggregator::get_port");
1385313856
if (components.port == url_components::omitted) {
1385413857
return "";
@@ -13857,7 +13860,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
1385713860
components.pathname_start);
1385813861
}
1385913862

13860-
[[nodiscard]] std::string_view url_aggregator::get_hash() const noexcept {
13863+
[[nodiscard]] std::string_view url_aggregator::get_hash() const noexcept
13864+
ada_lifetime_bound {
1386113865
ada_log("url_aggregator::get_hash");
1386213866
// If this's URL's fragment is either null or the empty string, then return
1386313867
// the empty string. Return U+0023 (#), followed by this's URL's fragment.
@@ -13870,7 +13874,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
1387013874
return helpers::substring(buffer, components.hash_start);
1387113875
}
1387213876

13873-
[[nodiscard]] std::string_view url_aggregator::get_host() const noexcept {
13877+
[[nodiscard]] std::string_view url_aggregator::get_host() const noexcept
13878+
ada_lifetime_bound {
1387413879
ada_log("url_aggregator::get_host");
1387513880
// Technically, we should check if there is a hostname, but
1387613881
// the code below works even if there isn't.
@@ -13888,7 +13893,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
1388813893
return helpers::substring(buffer, start, components.pathname_start);
1388913894
}
1389013895

13891-
[[nodiscard]] std::string_view url_aggregator::get_hostname() const noexcept {
13896+
[[nodiscard]] std::string_view url_aggregator::get_hostname() const noexcept
13897+
ada_lifetime_bound {
1389213898
ada_log("url_aggregator::get_hostname");
1389313899
// Technically, we should check if there is a hostname, but
1389413900
// the code below works even if there isn't.
@@ -13902,7 +13908,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
1390213908
return helpers::substring(buffer, start, components.host_end);
1390313909
}
1390413910

13905-
[[nodiscard]] std::string_view url_aggregator::get_pathname() const noexcept {
13911+
[[nodiscard]] std::string_view url_aggregator::get_pathname() const noexcept
13912+
ada_lifetime_bound {
1390613913
ada_log("url_aggregator::get_pathname pathname_start = ",
1390713914
components.pathname_start, " buffer.size() = ", buffer.size(),
1390813915
" components.search_start = ", components.search_start,
@@ -13916,7 +13923,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
1391613923
return helpers::substring(buffer, components.pathname_start, ending_index);
1391713924
}
1391813925

13919-
[[nodiscard]] std::string_view url_aggregator::get_search() const noexcept {
13926+
[[nodiscard]] std::string_view url_aggregator::get_search() const noexcept
13927+
ada_lifetime_bound {
1392013928
ada_log("url_aggregator::get_search");
1392113929
// If this's URL's query is either null or the empty string, then return the
1392213930
// empty string. Return U+003F (?), followed by this's URL's query.
@@ -13933,7 +13941,8 @@ bool url_aggregator::set_hostname(const std::string_view input) {
1393313941
return helpers::substring(buffer, components.search_start, ending_index);
1393413942
}
1393513943

13936-
[[nodiscard]] std::string_view url_aggregator::get_protocol() const noexcept {
13944+
[[nodiscard]] std::string_view url_aggregator::get_protocol() const noexcept
13945+
ada_lifetime_bound {
1393713946
ada_log("url_aggregator::get_protocol");
1393813947
return helpers::substring(buffer, 0, components.protocol_end);
1393913948
}

ada_url/ada.h

+46-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on 2024-07-06 17:38:56 -0400. Do not edit! */
1+
/* auto-generated on 2024-08-24 20:20:43 -0400. Do not edit! */
22
/* begin file include/ada.h */
33
/**
44
* @file ada.h
@@ -479,6 +479,18 @@ namespace ada {
479479
#define ADA_NEON 1
480480
#endif
481481

482+
#ifndef __has_cpp_attribute
483+
#define ada_lifetime_bound
484+
#elif __has_cpp_attribute(msvc::lifetimebound)
485+
#define ada_lifetime_bound [[msvc::lifetimebound]]
486+
#elif __has_cpp_attribute(clang::lifetimebound)
487+
#define ada_lifetime_bound [[clang::lifetimebound]]
488+
#elif __has_cpp_attribute(lifetimebound)
489+
#define ada_lifetime_bound [[lifetimebound]]
490+
#else
491+
#define ada_lifetime_bound
492+
#endif
493+
482494
#endif // ADA_COMMON_DEFS_H
483495
/* end file include/ada/common_defs.h */
484496
#include <cstdint>
@@ -4845,35 +4857,38 @@ struct url_aggregator : url_base {
48454857
* @see https://url.spec.whatwg.org/#dom-url-href
48464858
* @see https://url.spec.whatwg.org/#concept-url-serializer
48474859
*/
4848-
[[nodiscard]] inline std::string_view get_href() const noexcept;
4860+
[[nodiscard]] inline std::string_view get_href() const noexcept
4861+
ada_lifetime_bound;
48494862
/**
48504863
* The username getter steps are to return this's URL's username.
48514864
* This function does not allocate memory.
48524865
* @return a lightweight std::string_view.
48534866
* @see https://url.spec.whatwg.org/#dom-url-username
48544867
*/
4855-
[[nodiscard]] std::string_view get_username() const noexcept;
4868+
[[nodiscard]] std::string_view get_username() const noexcept
4869+
ada_lifetime_bound;
48564870
/**
48574871
* The password getter steps are to return this's URL's password.
48584872
* This function does not allocate memory.
48594873
* @return a lightweight std::string_view.
48604874
* @see https://url.spec.whatwg.org/#dom-url-password
48614875
*/
4862-
[[nodiscard]] std::string_view get_password() const noexcept;
4876+
[[nodiscard]] std::string_view get_password() const noexcept
4877+
ada_lifetime_bound;
48634878
/**
48644879
* Return this's URL's port, serialized.
48654880
* This function does not allocate memory.
48664881
* @return a lightweight std::string_view.
48674882
* @see https://url.spec.whatwg.org/#dom-url-port
48684883
*/
4869-
[[nodiscard]] std::string_view get_port() const noexcept;
4884+
[[nodiscard]] std::string_view get_port() const noexcept ada_lifetime_bound;
48704885
/**
48714886
* Return U+0023 (#), followed by this's URL's fragment.
48724887
* This function does not allocate memory.
48734888
* @return a lightweight std::string_view..
48744889
* @see https://url.spec.whatwg.org/#dom-url-hash
48754890
*/
4876-
[[nodiscard]] std::string_view get_hash() const noexcept;
4891+
[[nodiscard]] std::string_view get_hash() const noexcept ada_lifetime_bound;
48774892
/**
48784893
* Return url's host, serialized, followed by U+003A (:) and url's port,
48794894
* serialized.
@@ -4882,23 +4897,25 @@ struct url_aggregator : url_base {
48824897
* @return a lightweight std::string_view.
48834898
* @see https://url.spec.whatwg.org/#dom-url-host
48844899
*/
4885-
[[nodiscard]] std::string_view get_host() const noexcept;
4900+
[[nodiscard]] std::string_view get_host() const noexcept ada_lifetime_bound;
48864901
/**
48874902
* Return this's URL's host, serialized.
48884903
* This function does not allocate memory.
48894904
* When there is no host, this function returns the empty view.
48904905
* @return a lightweight std::string_view.
48914906
* @see https://url.spec.whatwg.org/#dom-url-hostname
48924907
*/
4893-
[[nodiscard]] std::string_view get_hostname() const noexcept;
4908+
[[nodiscard]] std::string_view get_hostname() const noexcept
4909+
ada_lifetime_bound;
48944910
/**
48954911
* The pathname getter steps are to return the result of URL path serializing
48964912
* this's URL.
48974913
* This function does not allocate memory.
48984914
* @return a lightweight std::string_view.
48994915
* @see https://url.spec.whatwg.org/#dom-url-pathname
49004916
*/
4901-
[[nodiscard]] std::string_view get_pathname() const noexcept;
4917+
[[nodiscard]] std::string_view get_pathname() const noexcept
4918+
ada_lifetime_bound;
49024919
/**
49034920
* Compute the pathname length in bytes without instantiating a view or a
49044921
* string.
@@ -4912,15 +4929,16 @@ struct url_aggregator : url_base {
49124929
* @return a lightweight std::string_view.
49134930
* @see https://url.spec.whatwg.org/#dom-url-search
49144931
*/
4915-
[[nodiscard]] std::string_view get_search() const noexcept;
4932+
[[nodiscard]] std::string_view get_search() const noexcept ada_lifetime_bound;
49164933
/**
49174934
* The protocol getter steps are to return this's URL's scheme, followed by
49184935
* U+003A (:).
49194936
* This function does not allocate memory.
49204937
* @return a lightweight std::string_view.
49214938
* @see https://url.spec.whatwg.org/#dom-url-protocol
49224939
*/
4923-
[[nodiscard]] std::string_view get_protocol() const noexcept;
4940+
[[nodiscard]] std::string_view get_protocol() const noexcept
4941+
ada_lifetime_bound;
49244942

49254943
/**
49264944
* A URL includes credentials if its username or password is not the empty
@@ -5828,7 +5846,7 @@ inline void url::set_scheme(std::string &&new_scheme) noexcept {
58285846
type = ada::scheme::get_scheme_type(new_scheme);
58295847
// We only move the 'scheme' if it is non-special.
58305848
if (!is_special()) {
5831-
non_special_scheme = new_scheme;
5849+
non_special_scheme = std::move(new_scheme);
58325850
}
58335851
}
58345852

@@ -5877,10 +5895,15 @@ inline void url::copy_scheme(const ada::url &u) {
58775895
ada_really_inline size_t url::parse_port(std::string_view view,
58785896
bool check_trailing_content) noexcept {
58795897
ada_log("parse_port('", view, "') ", view.size());
5898+
if (!view.empty() && view[0] == '-') {
5899+
ada_log("parse_port: view[0] == '0' && view.size() > 1");
5900+
is_valid = false;
5901+
return 0;
5902+
}
58805903
uint16_t parsed_port{};
58815904
auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
58825905
if (r.ec == std::errc::result_out_of_range) {
5883-
ada_log("parse_port: std::errc::result_out_of_range");
5906+
ada_log("parse_port: r.ec == std::errc::result_out_of_range");
58845907
is_valid = false;
58855908
return 0;
58865909
}
@@ -6776,19 +6799,24 @@ inline bool url_aggregator::has_port() const noexcept {
67766799
buffer[components.host_end + 1] == '.';
67776800
}
67786801

6779-
[[nodiscard]] inline std::string_view url_aggregator::get_href()
6780-
const noexcept {
6802+
[[nodiscard]] inline std::string_view url_aggregator::get_href() const noexcept
6803+
ada_lifetime_bound {
67816804
ada_log("url_aggregator::get_href");
67826805
return buffer;
67836806
}
67846807

67856808
ada_really_inline size_t url_aggregator::parse_port(
67866809
std::string_view view, bool check_trailing_content) noexcept {
67876810
ada_log("url_aggregator::parse_port('", view, "') ", view.size());
6811+
if (!view.empty() && view[0] == '-') {
6812+
ada_log("parse_port: view[0] == '0' && view.size() > 1");
6813+
is_valid = false;
6814+
return 0;
6815+
}
67886816
uint16_t parsed_port{};
67896817
auto r = std::from_chars(view.data(), view.data() + view.size(), parsed_port);
67906818
if (r.ec == std::errc::result_out_of_range) {
6791-
ada_log("parse_port: std::errc::result_out_of_range");
6819+
ada_log("parse_port: r.ec == std::errc::result_out_of_range");
67926820
is_valid = false;
67936821
return 0;
67946822
}
@@ -7279,14 +7307,14 @@ url_search_params_entries_iter::next() {
72797307
#ifndef ADA_ADA_VERSION_H
72807308
#define ADA_ADA_VERSION_H
72817309

7282-
#define ADA_VERSION "2.9.0"
7310+
#define ADA_VERSION "2.9.1"
72837311

72847312
namespace ada {
72857313

72867314
enum {
72877315
ADA_VERSION_MAJOR = 2,
72887316
ADA_VERSION_MINOR = 9,
7289-
ADA_VERSION_REVISION = 0,
7317+
ADA_VERSION_REVISION = 1,
72907318
};
72917319

72927320
} // namespace ada

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "ada-url"
7-
version = "1.15.0"
7+
version = "1.15.1"
88
authors = [
99
{name = "Bo Bayles", email = "[email protected]"},
1010
]

0 commit comments

Comments
 (0)