diff --git a/Userland/Libraries/LibWeb/Fetch/Headers.cpp b/Userland/Libraries/LibWeb/Fetch/Headers.cpp index 5c097a9412..2c3890f920 100644 --- a/Userland/Libraries/LibWeb/Fetch/Headers.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Headers.cpp @@ -282,20 +282,20 @@ WebIDL::ExceptionOr 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> const& object) -> WebIDL::ExceptionOr { 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 (header’s first item, header’s 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 const& object) -> WebIDL::ExceptionOr { for (auto const& entry : object) { auto header = TRY_OR_RETURN_OOM(realm(), Infrastructure::Header::from_string_pair(entry.key, entry.value)); diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.cpp index 422d80d38c..5ab9841ae1 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Headers.cpp @@ -261,7 +261,7 @@ ErrorOr> 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 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; } diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp index d91a449a8c..7e7da22c9d 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Requests.cpp @@ -153,7 +153,7 @@ bool Request::has_redirect_tainted_origin() const // 1. Let lastURL be null. Optional last_url; - // 2. For each url in request’s URL list: + // 2. For each url of request’s 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()) { diff --git a/Userland/Libraries/LibWeb/Fetch/Request.cpp b/Userland/Libraries/LibWeb/Fetch/Request.cpp index 180c56ae3f..2ef5c8f5d9 100644 --- a/Userland/Libraries/LibWeb/Fetch/Request.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Request.cpp @@ -413,7 +413,7 @@ WebIDL::ExceptionOr> Request::construct_impl(JS::Realm // 3. Empty this’s headers’s header list. request_object->headers()->header_list()->clear(); - // 4. If headers is a Headers object, then for each header in its header list, append (header’s name, header’s value) to this’s headers. + // 4. If headers is a Headers object, then for each header of its header list, append header to this’s headers. if (auto* header_list = headers.get_pointer>()) { for (auto& header : *header_list->ptr()) TRY(request_object->headers()->append(DeprecatedString::copy(header.name), DeprecatedString::copy(header.value)));