mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-23 15:47:30 +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>
|
template <class Derived>
|
||||||
FetchBody<Derived>::FetchBody()
|
FetchBody<Derived>::FetchBody(nsIGlobalObject* aOwner)
|
||||||
: mWorkerPrivate(nullptr)
|
: mWorkerPrivate(nullptr)
|
||||||
|
, mOwner(aOwner)
|
||||||
, mReadableStreamBody(nullptr)
|
, mReadableStreamBody(nullptr)
|
||||||
, mBodyUsed(false)
|
, mBodyUsed(false)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(aOwner);
|
||||||
|
|
||||||
if (!NS_IsMainThread()) {
|
if (!NS_IsMainThread()) {
|
||||||
mWorkerPrivate = GetCurrentThreadWorkerPrivate();
|
mWorkerPrivate = GetCurrentThreadWorkerPrivate();
|
||||||
MOZ_ASSERT(mWorkerPrivate);
|
MOZ_ASSERT(mWorkerPrivate);
|
||||||
|
} else {
|
||||||
|
mWorkerPrivate = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template
|
template
|
||||||
FetchBody<Request>::FetchBody();
|
FetchBody<Request>::FetchBody(nsIGlobalObject* aOwner);
|
||||||
|
|
||||||
template
|
template
|
||||||
FetchBody<Response>::FetchBody();
|
FetchBody<Response>::FetchBody(nsIGlobalObject* aOwner);
|
||||||
|
|
||||||
template <class Derived>
|
template <class Derived>
|
||||||
FetchBody<Derived>::~FetchBody()
|
FetchBody<Derived>::~FetchBody()
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
#include "mozilla/dom/RequestBinding.h"
|
#include "mozilla/dom/RequestBinding.h"
|
||||||
|
|
||||||
class nsIGlobalObject;
|
class nsIGlobalObject;
|
||||||
|
class nsIEventTarget;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
@ -208,7 +209,9 @@ public:
|
||||||
GetSignal() const = 0;
|
GetSignal() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FetchBody();
|
nsCOMPtr<nsIGlobalObject> mOwner;
|
||||||
|
|
||||||
|
explicit FetchBody(nsIGlobalObject* aOwner);
|
||||||
|
|
||||||
// Always set whenever the FetchBody is created on the worker thread.
|
// Always set whenever the FetchBody is created on the worker thread.
|
||||||
workers::WorkerPrivate* mWorkerPrivate;
|
workers::WorkerPrivate* mWorkerPrivate;
|
||||||
|
|
@ -252,6 +255,9 @@ private:
|
||||||
// Only ever set once, always on target thread.
|
// Only ever set once, always on target thread.
|
||||||
bool mBodyUsed;
|
bool mBodyUsed;
|
||||||
nsCString mMimeType;
|
nsCString mMimeType;
|
||||||
|
|
||||||
|
// The main-thread event target for runnable dispatching.
|
||||||
|
nsCOMPtr<nsIEventTarget> mMainThreadEventTarget;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Request)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
Request::Request(nsIGlobalObject* aOwner, InternalRequest* aRequest, AbortSignal* aSignal)
|
Request::Request(nsIGlobalObject* aOwner, InternalRequest* aRequest, AbortSignal* aSignal)
|
||||||
: FetchBody<Request>()
|
: FetchBody<Request>(aOwner)
|
||||||
, mOwner(aOwner)
|
|
||||||
, mRequest(aRequest)
|
, mRequest(aRequest)
|
||||||
, mSignal(aSignal)
|
, mSignal(aSignal)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,6 @@ public:
|
||||||
private:
|
private:
|
||||||
~Request();
|
~Request();
|
||||||
|
|
||||||
nsCOMPtr<nsIGlobalObject> mOwner;
|
|
||||||
RefPtr<InternalRequest> mRequest;
|
RefPtr<InternalRequest> mRequest;
|
||||||
|
|
||||||
// Lazily created.
|
// Lazily created.
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Response)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
Response::Response(nsIGlobalObject* aGlobal, InternalResponse* aInternalResponse, AbortSignal* aSignal)
|
Response::Response(nsIGlobalObject* aGlobal, InternalResponse* aInternalResponse, AbortSignal* aSignal)
|
||||||
: FetchBody<Response>()
|
: FetchBody<Response>(aGlobal)
|
||||||
, mOwner(aGlobal)
|
|
||||||
, mInternalResponse(aInternalResponse)
|
, mInternalResponse(aInternalResponse)
|
||||||
, mSignal(aSignal)
|
, mSignal(aSignal)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,6 @@ public:
|
||||||
private:
|
private:
|
||||||
~Response();
|
~Response();
|
||||||
|
|
||||||
nsCOMPtr<nsIGlobalObject> mOwner;
|
|
||||||
RefPtr<InternalResponse> mInternalResponse;
|
RefPtr<InternalResponse> mInternalResponse;
|
||||||
|
|
||||||
// Lazily created
|
// Lazily created
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue