mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 15:28:39 +09:00
Issue #1442 - Part 12 - Label FetchBody. https://bugzilla.mozilla.org/show_bug.cgi?id=1363318 FetchSignal is not in our tree so this is a partial patch to get mOwner changes. Pre-requisite for Part 13.
This commit is contained in:
parent
a8a75090c0
commit
346e8a87d7
6 changed files with 17 additions and 10 deletions
|
|
@ -877,22 +877,27 @@ ExtractByteStreamFromBody(const fetch::ResponseBodyInit& aBodyInit,
|
|||
|
||||
|
||||
template <class Derived>
|
||||
FetchBody<Derived>::FetchBody()
|
||||
FetchBody<Derived>::FetchBody(nsIGlobalObject* aOwner)
|
||||
: mWorkerPrivate(nullptr)
|
||||
, mOwner(aOwner)
|
||||
, mReadableStreamBody(nullptr)
|
||||
, mBodyUsed(false)
|
||||
{
|
||||
MOZ_ASSERT(aOwner);
|
||||
|
||||
if (!NS_IsMainThread()) {
|
||||
mWorkerPrivate = GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(mWorkerPrivate);
|
||||
} else {
|
||||
mWorkerPrivate = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
template
|
||||
FetchBody<Request>::FetchBody();
|
||||
FetchBody<Request>::FetchBody(nsIGlobalObject* aOwner);
|
||||
|
||||
template
|
||||
FetchBody<Response>::FetchBody();
|
||||
FetchBody<Response>::FetchBody(nsIGlobalObject* aOwner);
|
||||
|
||||
template <class Derived>
|
||||
FetchBody<Derived>::~FetchBody()
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#include "mozilla/dom/RequestBinding.h"
|
||||
|
||||
class nsIGlobalObject;
|
||||
class nsIEventTarget;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
@ -208,7 +209,9 @@ public:
|
|||
GetSignal() const = 0;
|
||||
|
||||
protected:
|
||||
FetchBody();
|
||||
nsCOMPtr<nsIGlobalObject> mOwner;
|
||||
|
||||
explicit FetchBody(nsIGlobalObject* aOwner);
|
||||
|
||||
// Always set whenever the FetchBody is created on the worker thread.
|
||||
workers::WorkerPrivate* mWorkerPrivate;
|
||||
|
|
@ -252,6 +255,9 @@ private:
|
|||
// Only ever set once, always on target thread.
|
||||
bool mBodyUsed;
|
||||
nsCString mMimeType;
|
||||
|
||||
// The main-thread event target for runnable dispatching.
|
||||
nsCOMPtr<nsIEventTarget> mMainThreadEventTarget;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
|||
|
|
@ -54,8 +54,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Request)
|
|||
NS_INTERFACE_MAP_END
|
||||
|
||||
Request::Request(nsIGlobalObject* aOwner, InternalRequest* aRequest, AbortSignal* aSignal)
|
||||
: FetchBody<Request>()
|
||||
, mOwner(aOwner)
|
||||
: FetchBody<Request>(aOwner)
|
||||
, mRequest(aRequest)
|
||||
, mSignal(aSignal)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -164,7 +164,6 @@ public:
|
|||
private:
|
||||
~Request();
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> mOwner;
|
||||
RefPtr<InternalRequest> mRequest;
|
||||
|
||||
// Lazily created.
|
||||
|
|
|
|||
|
|
@ -57,8 +57,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Response)
|
|||
NS_INTERFACE_MAP_END
|
||||
|
||||
Response::Response(nsIGlobalObject* aGlobal, InternalResponse* aInternalResponse, AbortSignal* aSignal)
|
||||
: FetchBody<Response>()
|
||||
, mOwner(aGlobal)
|
||||
: FetchBody<Response>(aGlobal)
|
||||
, mInternalResponse(aInternalResponse)
|
||||
, mSignal(aSignal)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -144,7 +144,6 @@ public:
|
|||
private:
|
||||
~Response();
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> mOwner;
|
||||
RefPtr<InternalResponse> mInternalResponse;
|
||||
|
||||
// Lazily created
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue