1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-23 10:07:40 +00:00

LibWeb/Fetch: Tweak wording in some spec comments

This is a change in the Fetch spec.

See: 223ca89
This commit is contained in:
Linus Groh 2022-12-07 18:29:17 +00:00
parent a156722744
commit 2f1bda3347
4 changed files with 8 additions and 8 deletions

View file

@ -282,20 +282,20 @@ WebIDL::ExceptionOr<void> Headers::fill(HeadersInit const& object)
{
// To fill a Headers object headers with a given object object, run these steps:
return object.visit(
// 1. If object is a sequence, then for each header in object:
// 1. If object is a sequence, then for each header of object:
[this](Vector<Vector<DeprecatedString>> const& object) -> WebIDL::ExceptionOr<void> {
for (auto const& entry : object) {
// 1. If header does not contain exactly two items, then throw a TypeError.
// 1. If header's size is not 2, then throw a TypeError.
if (entry.size() != 2)
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Array must contain header key/value pair"sv };
// 2. Append (headers first item, headers second item) to headers.
// 2. Append (header[0], header[1]) to headers.
auto header = TRY_OR_RETURN_OOM(realm(), Infrastructure::Header::from_string_pair(entry[0], entry[1].bytes()));
TRY(append(move(header)));
}
return {};
},
// 2. Otherwise, object is a record, then for each key → value in object, append (key, value) to headers.
// 2. Otherwise, object is a record, then for each key → value of object, append (key, value) to headers.
[this](OrderedHashMap<DeprecatedString, DeprecatedString> const& object) -> WebIDL::ExceptionOr<void> {
for (auto const& entry : object) {
auto header = TRY_OR_RETURN_OOM(realm(), Infrastructure::Header::from_string_pair(entry.key, entry.value));

View file

@ -261,7 +261,7 @@ ErrorOr<Vector<Header>> HeaderList::sort_and_combine() const
names_list.append(header.name);
auto names = TRY(convert_header_names_to_a_sorted_lowercase_set(names_list));
// 3. For each name in names:
// 3. For each name of names:
for (auto& name : names) {
// 1. Let value be the result of getting name from list.
// 2. Assert: value is not null.
@ -640,7 +640,7 @@ ErrorOr<bool> is_forbidden_request_header(Header const& header)
// 1. Let parsedValues be the result of getting, decoding, and splitting value.
auto parsed_values = TRY(get_decode_and_split_header_value(header.value));
// 2. For each method in parsedValues: if the isomorphic encoding of method is a forbidden method, then return true.
// 2. For each method of parsedValues: if the isomorphic encoding of method is a forbidden method, then return true.
if (parsed_values.has_value() && any_of(*parsed_values, [](auto method) { return is_forbidden_method(method.bytes()); }))
return true;
}

View file

@ -153,7 +153,7 @@ bool Request::has_redirect_tainted_origin() const
// 1. Let lastURL be null.
Optional<AK::URL const&> last_url;
// 2. For each url in requests URL list:
// 2. For each url of requests URL list:
for (auto const& url : m_url_list) {
// 1. If lastURL is null, then set lastURL to url and continue.
if (!last_url.has_value()) {

View file

@ -413,7 +413,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Request>> Request::construct_impl(JS::Realm
// 3. Empty thiss headerss header list.
request_object->headers()->header_list()->clear();
// 4. If headers is a Headers object, then for each header in its header list, append (headers name, headers value) to thiss headers.
// 4. If headers is a Headers object, then for each header of its header list, append header to thiss headers.
if (auto* header_list = headers.get_pointer<JS::NonnullGCPtr<Infrastructure::HeaderList>>()) {
for (auto& header : *header_list->ptr())
TRY(request_object->headers()->append(DeprecatedString::copy(header.name), DeprecatedString::copy(header.value)));