1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:17:44 +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));