mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 09:27:35 +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:
parent
a156722744
commit
2f1bda3347
4 changed files with 8 additions and 8 deletions
|
@ -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:
|
// To fill a Headers object headers with a given object object, run these steps:
|
||||||
return object.visit(
|
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> {
|
[this](Vector<Vector<DeprecatedString>> const& object) -> WebIDL::ExceptionOr<void> {
|
||||||
for (auto const& entry : object) {
|
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)
|
if (entry.size() != 2)
|
||||||
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Array must contain header key/value pair"sv };
|
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()));
|
auto header = TRY_OR_RETURN_OOM(realm(), Infrastructure::Header::from_string_pair(entry[0], entry[1].bytes()));
|
||||||
TRY(append(move(header)));
|
TRY(append(move(header)));
|
||||||
}
|
}
|
||||||
return {};
|
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> {
|
[this](OrderedHashMap<DeprecatedString, DeprecatedString> const& object) -> WebIDL::ExceptionOr<void> {
|
||||||
for (auto const& entry : object) {
|
for (auto const& entry : object) {
|
||||||
auto header = TRY_OR_RETURN_OOM(realm(), Infrastructure::Header::from_string_pair(entry.key, entry.value));
|
auto header = TRY_OR_RETURN_OOM(realm(), Infrastructure::Header::from_string_pair(entry.key, entry.value));
|
||||||
|
|
|
@ -261,7 +261,7 @@ ErrorOr<Vector<Header>> HeaderList::sort_and_combine() const
|
||||||
names_list.append(header.name);
|
names_list.append(header.name);
|
||||||
auto names = TRY(convert_header_names_to_a_sorted_lowercase_set(names_list));
|
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) {
|
for (auto& name : names) {
|
||||||
// 1. Let value be the result of getting name from list.
|
// 1. Let value be the result of getting name from list.
|
||||||
// 2. Assert: value is not null.
|
// 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.
|
// 1. Let parsedValues be the result of getting, decoding, and splitting value.
|
||||||
auto parsed_values = TRY(get_decode_and_split_header_value(header.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()); }))
|
if (parsed_values.has_value() && any_of(*parsed_values, [](auto method) { return is_forbidden_method(method.bytes()); }))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ bool Request::has_redirect_tainted_origin() const
|
||||||
// 1. Let lastURL be null.
|
// 1. Let lastURL be null.
|
||||||
Optional<AK::URL const&> last_url;
|
Optional<AK::URL const&> 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) {
|
for (auto const& url : m_url_list) {
|
||||||
// 1. If lastURL is null, then set lastURL to url and continue.
|
// 1. If lastURL is null, then set lastURL to url and continue.
|
||||||
if (!last_url.has_value()) {
|
if (!last_url.has_value()) {
|
||||||
|
|
|
@ -413,7 +413,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Request>> Request::construct_impl(JS::Realm
|
||||||
// 3. Empty this’s headers’s header list.
|
// 3. Empty this’s headers’s header list.
|
||||||
request_object->headers()->header_list()->clear();
|
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<JS::NonnullGCPtr<Infrastructure::HeaderList>>()) {
|
if (auto* header_list = headers.get_pointer<JS::NonnullGCPtr<Infrastructure::HeaderList>>()) {
|
||||||
for (auto& header : *header_list->ptr())
|
for (auto& header : *header_list->ptr())
|
||||||
TRY(request_object->headers()->append(DeprecatedString::copy(header.name), DeprecatedString::copy(header.value)));
|
TRY(request_object->headers()->append(DeprecatedString::copy(header.name), DeprecatedString::copy(header.value)));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue