From dd2c9eb41877eacac3d16fc6f3cc6dcfbd381e4b Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Wed, 27 Sep 2023 19:08:24 -0500 Subject: [PATCH] Issue #1442 - Part 7: Use of ReadableStream in WebIDL files. https://bugzilla.mozilla.org/show_bug.cgi?id=1128959 --- dom/fetch/Fetch.cpp | 19 +++++++++++++++++++ dom/fetch/Fetch.h | 4 ++++ dom/fetch/Request.h | 2 ++ dom/fetch/Response.h | 2 ++ dom/webidl/Response.webidl | 5 +++++ 5 files changed, 32 insertions(+) diff --git a/dom/fetch/Fetch.cpp b/dom/fetch/Fetch.cpp index 6a6b4faaf8..42c9fc74f9 100644 --- a/dom/fetch/Fetch.cpp +++ b/dom/fetch/Fetch.cpp @@ -1000,5 +1000,24 @@ template void FetchBody::SetMimeType(); +template +void +FetchBody::GetBody(JSContext* aCx, + JS::MutableHandle aMessage) +{ + // TODO +} + +template +void +FetchBody::GetBody(JSContext* aCx, + JS::MutableHandle aMessage); + +template +void +FetchBody::GetBody(JSContext* aCx, + JS::MutableHandle aMessage); + + } // namespace dom } // namespace mozilla diff --git a/dom/fetch/Fetch.h b/dom/fetch/Fetch.h index 73d5c15199..bc2df62689 100644 --- a/dom/fetch/Fetch.h +++ b/dom/fetch/Fetch.h @@ -147,6 +147,10 @@ public: return ConsumeBody(CONSUME_TEXT, aRv); } + void + GetBody(JSContext* aCx, + JS::MutableHandle aMessage); + // Utility public methods accessed by various runnables. void diff --git a/dom/fetch/Request.h b/dom/fetch/Request.h index 8c01cbd799..8a22f1340b 100644 --- a/dom/fetch/Request.h +++ b/dom/fetch/Request.h @@ -128,6 +128,8 @@ public: void GetBody(nsIInputStream** aStream) { return mRequest->GetBody(aStream); } + using FetchBody::GetBody; + void SetBody(nsIInputStream* aStream) { return mRequest->SetBody(aStream); } diff --git a/dom/fetch/Response.h b/dom/fetch/Response.h index fa2ced87d8..61f1427f93 100644 --- a/dom/fetch/Response.h +++ b/dom/fetch/Response.h @@ -105,6 +105,8 @@ public: void GetBody(nsIInputStream** aStream) { return mInternalResponse->GetBody(aStream); } + using FetchBody::GetBody; + static already_AddRefed Error(const GlobalObject& aGlobal); diff --git a/dom/webidl/Response.webidl b/dom/webidl/Response.webidl index 08f31fe29a..adaa70d66d 100644 --- a/dom/webidl/Response.webidl +++ b/dom/webidl/Response.webidl @@ -30,6 +30,11 @@ interface Response { }; Response implements Body; +// This should be part of Body but we don't want to expose body to request yet. +partial interface Response { + readonly attribute ReadableStream? body; +}; + dictionary ResponseInit { unsigned short status = 200; ByteString statusText = "OK";