mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:37:37 +00:00
LibWeb: Fix typo in BodyInitOrReadableBytes type alias
This commit is contained in:
parent
00326a63ed
commit
a2a4ad3b9d
3 changed files with 11 additions and 11 deletions
|
@ -14,7 +14,7 @@
|
||||||
namespace Web::Fetch {
|
namespace Web::Fetch {
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#bodyinit-safely-extract
|
// https://fetch.spec.whatwg.org/#bodyinit-safely-extract
|
||||||
WebIDL::ExceptionOr<Infrastructure::BodyWithType> safely_extract_body(JS::Realm& realm, BodyInitOrReadbleBytes const& object)
|
WebIDL::ExceptionOr<Infrastructure::BodyWithType> safely_extract_body(JS::Realm& realm, BodyInitOrReadableBytes const& object)
|
||||||
{
|
{
|
||||||
// 1. If object is a ReadableStream object, then:
|
// 1. If object is a ReadableStream object, then:
|
||||||
if (auto const* stream = object.get_pointer<JS::Handle<Streams::ReadableStream>>()) {
|
if (auto const* stream = object.get_pointer<JS::Handle<Streams::ReadableStream>>()) {
|
||||||
|
@ -27,7 +27,7 @@ WebIDL::ExceptionOr<Infrastructure::BodyWithType> safely_extract_body(JS::Realm&
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#concept-bodyinit-extract
|
// https://fetch.spec.whatwg.org/#concept-bodyinit-extract
|
||||||
WebIDL::ExceptionOr<Infrastructure::BodyWithType> extract_body(JS::Realm& realm, BodyInitOrReadbleBytes const& object, bool keepalive)
|
WebIDL::ExceptionOr<Infrastructure::BodyWithType> extract_body(JS::Realm& realm, BodyInitOrReadableBytes const& object, bool keepalive)
|
||||||
{
|
{
|
||||||
// 1. Let stream be null.
|
// 1. Let stream be null.
|
||||||
JS::GCPtr<Streams::ReadableStream> stream;
|
JS::GCPtr<Streams::ReadableStream> stream;
|
||||||
|
|
|
@ -19,8 +19,8 @@ using XMLHttpRequestBodyInit = Variant<JS::Handle<FileAPI::Blob>, JS::Handle<JS:
|
||||||
// https://fetch.spec.whatwg.org/#bodyinit
|
// https://fetch.spec.whatwg.org/#bodyinit
|
||||||
using BodyInit = Variant<JS::Handle<Streams::ReadableStream>, JS::Handle<FileAPI::Blob>, JS::Handle<JS::Object>, JS::Handle<URL::URLSearchParams>, String>;
|
using BodyInit = Variant<JS::Handle<Streams::ReadableStream>, JS::Handle<FileAPI::Blob>, JS::Handle<JS::Object>, JS::Handle<URL::URLSearchParams>, String>;
|
||||||
|
|
||||||
using BodyInitOrReadbleBytes = Variant<JS::Handle<Streams::ReadableStream>, JS::Handle<FileAPI::Blob>, JS::Handle<JS::Object>, JS::Handle<URL::URLSearchParams>, String, ReadonlyBytes>;
|
using BodyInitOrReadableBytes = Variant<JS::Handle<Streams::ReadableStream>, JS::Handle<FileAPI::Blob>, JS::Handle<JS::Object>, JS::Handle<URL::URLSearchParams>, String, ReadonlyBytes>;
|
||||||
WebIDL::ExceptionOr<Infrastructure::BodyWithType> safely_extract_body(JS::Realm&, BodyInitOrReadbleBytes const&);
|
WebIDL::ExceptionOr<Infrastructure::BodyWithType> safely_extract_body(JS::Realm&, BodyInitOrReadableBytes const&);
|
||||||
WebIDL::ExceptionOr<Infrastructure::BodyWithType> extract_body(JS::Realm&, BodyInitOrReadbleBytes const&, bool keepalive = false);
|
WebIDL::ExceptionOr<Infrastructure::BodyWithType> extract_body(JS::Realm&, BodyInitOrReadableBytes const&, bool keepalive = false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1018,10 +1018,10 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_redirect_fetch(JS::R
|
||||||
// NOTE: request’s body’s source’s nullity has already been checked.
|
// NOTE: request’s body’s source’s nullity has already been checked.
|
||||||
if (!request->body().has<Empty>()) {
|
if (!request->body().has<Empty>()) {
|
||||||
auto const& source = request->body().get<Infrastructure::Body>().source();
|
auto const& source = request->body().get<Infrastructure::Body>().source();
|
||||||
// NOTE: BodyInitOrReadbleBytes is a superset of Body::SourceType
|
// NOTE: BodyInitOrReadableBytes is a superset of Body::SourceType
|
||||||
auto converted_source = source.has<ByteBuffer>()
|
auto converted_source = source.has<ByteBuffer>()
|
||||||
? BodyInitOrReadbleBytes { source.get<ByteBuffer>() }
|
? BodyInitOrReadableBytes { source.get<ByteBuffer>() }
|
||||||
: BodyInitOrReadbleBytes { source.get<JS::Handle<FileAPI::Blob>>() };
|
: BodyInitOrReadableBytes { source.get<JS::Handle<FileAPI::Blob>>() };
|
||||||
auto [body, _] = TRY(safely_extract_body(realm, converted_source));
|
auto [body, _] = TRY(safely_extract_body(realm, converted_source));
|
||||||
request->set_body(move(body));
|
request->set_body(move(body));
|
||||||
}
|
}
|
||||||
|
@ -1432,10 +1432,10 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_network_or_cache_fet
|
||||||
|
|
||||||
// 2. Set request’s body to the body of the result of safely extracting request’s body’s source.
|
// 2. Set request’s body to the body of the result of safely extracting request’s body’s source.
|
||||||
auto const& source = request->body().get<Infrastructure::Body>().source();
|
auto const& source = request->body().get<Infrastructure::Body>().source();
|
||||||
// NOTE: BodyInitOrReadbleBytes is a superset of Body::SourceType
|
// NOTE: BodyInitOrReadableBytes is a superset of Body::SourceType
|
||||||
auto converted_source = source.has<ByteBuffer>()
|
auto converted_source = source.has<ByteBuffer>()
|
||||||
? BodyInitOrReadbleBytes { source.get<ByteBuffer>() }
|
? BodyInitOrReadableBytes { source.get<ByteBuffer>() }
|
||||||
: BodyInitOrReadbleBytes { source.get<JS::Handle<FileAPI::Blob>>() };
|
: BodyInitOrReadableBytes { source.get<JS::Handle<FileAPI::Blob>>() };
|
||||||
auto [body, _] = TRY_OR_IGNORE(safely_extract_body(realm, converted_source));
|
auto [body, _] = TRY_OR_IGNORE(safely_extract_body(realm, converted_source));
|
||||||
request->set_body(move(body));
|
request->set_body(move(body));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue