diff options
author | Moonchild <moonchild@palemoon.org> | 2020-11-05 15:42:40 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-11-05 15:42:40 +0000 |
commit | 46b9c17c57aa02a22b981082488d22bcaf17304a (patch) | |
tree | 518c2990b0cfecb18ac115cc9c177014280d8ec9 | |
parent | da102ef405683a691330346c1072e7e3f6482b2f (diff) | |
download | uxp-46b9c17c57aa02a22b981082488d22bcaf17304a.tar.gz |
Issue #1442 - Part 8: Implement DOM Response().body as ReadableStream.
-rw-r--r-- | dom/fetch/Fetch.cpp | 19 | ||||
-rw-r--r-- | dom/fetch/Fetch.h | 4 | ||||
-rw-r--r-- | dom/fetch/Request.h | 2 | ||||
-rw-r--r-- | dom/fetch/Response.h | 2 | ||||
-rw-r--r-- | dom/webidl/Response.webidl | 5 |
5 files changed, 32 insertions, 0 deletions
diff --git a/dom/fetch/Fetch.cpp b/dom/fetch/Fetch.cpp index ed9cb542d4..a6c9eae8c7 100644 --- a/dom/fetch/Fetch.cpp +++ b/dom/fetch/Fetch.cpp @@ -1001,5 +1001,24 @@ template void FetchBody<Response>::SetMimeType(); +template <class Derived> +void +FetchBody<Derived>::GetBody(JSContext* aCx, + JS::MutableHandle<JSObject*> aMessage) +{ + // TODO +} + +template +void +FetchBody<Request>::GetBody(JSContext* aCx, + JS::MutableHandle<JSObject*> aMessage); + +template +void +FetchBody<Response>::GetBody(JSContext* aCx, + JS::MutableHandle<JSObject*> 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<JSObject*> 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<Response> 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"; |