1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:27:45 +00:00

LibWeb: Remove ReadableStreamDummy in favor of ReadableStream

This commit is contained in:
Linus Groh 2022-09-21 23:54:04 +01:00
parent 87654f5b51
commit f98ce156c4
3 changed files with 18 additions and 15 deletions

View file

@ -8,13 +8,13 @@
namespace Web::Fetch::Infrastructure {
Body::Body(ReadableStreamDummy stream)
: m_stream(stream)
Body::Body(JS::Handle<Streams::ReadableStream> stream)
: m_stream(move(stream))
{
}
Body::Body(ReadableStreamDummy stream, SourceType source, Optional<u64> length)
: m_stream(stream)
Body::Body(JS::Handle<Streams::ReadableStream> stream, SourceType source, Optional<u64> length)
: m_stream(move(stream))
, m_source(move(source))
, m_length(move(length))
{

View file

@ -13,6 +13,7 @@
#include <AK/Variant.h>
#include <LibJS/Heap/Handle.h>
#include <LibWeb/FileAPI/Blob.h>
#include <LibWeb/Streams/ReadableStream.h>
namespace Web::Fetch::Infrastructure {
@ -21,20 +22,17 @@ class Body final {
public:
using SourceType = Variant<Empty, ByteBuffer, JS::Handle<FileAPI::Blob>>;
struct ReadableStreamDummy { };
explicit Body(JS::Handle<Streams::ReadableStream>);
Body(JS::Handle<Streams::ReadableStream>, SourceType, Optional<u64>);
explicit Body(ReadableStreamDummy);
Body(ReadableStreamDummy, SourceType, Optional<u64>);
[[nodiscard]] ReadableStreamDummy const& stream() { return m_stream; }
[[nodiscard]] JS::NonnullGCPtr<Streams::ReadableStream> stream() { return *m_stream; }
[[nodiscard]] SourceType const& source() const { return m_source; }
[[nodiscard]] Optional<u64> const& length() const { return m_length; }
private:
// https://fetch.spec.whatwg.org/#concept-body-stream
// A stream (a ReadableStream object).
// FIXME: Just a placeholder for now.
ReadableStreamDummy m_stream;
JS::Handle<Streams::ReadableStream> m_stream;
// https://fetch.spec.whatwg.org/#concept-body-source
// A source (null, a byte sequence, a Blob object, or a FormData object), initially null.