summaryrefslogtreecommitdiffstats
path: root/dom/fetch
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-06-11 23:20:52 +0000
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-06-13 11:52:30 +0200
commit21403c31e0288ad3c1921019f6f6185a0019a9a4 (patch)
treebff457beb30b4756147a78d6c3b9f6e0f0e1baf8 /dom/fetch
parent29bca891d5ca243774a7355fc3a6a68903f0d596 (diff)
downloadUXP-21403c31e0288ad3c1921019f6f6185a0019a9a4.tar
UXP-21403c31e0288ad3c1921019f6f6185a0019a9a4.tar.gz
UXP-21403c31e0288ad3c1921019f6f6185a0019a9a4.tar.lz
UXP-21403c31e0288ad3c1921019f6f6185a0019a9a4.tar.xz
UXP-21403c31e0288ad3c1921019f6f6185a0019a9a4.zip
Issue #1587 - Part 7: Rename FetchController to AbortController
Also renames FetchSignal to AbortSignal. Includes renaming the various controlling prefs to enable.
Diffstat (limited to 'dom/fetch')
-rw-r--r--dom/fetch/Fetch.cpp52
-rw-r--r--dom/fetch/FetchDriver.cpp2
-rw-r--r--dom/fetch/FetchDriver.h8
-rw-r--r--dom/fetch/FetchObserver.cpp2
-rw-r--r--dom/fetch/FetchObserver.h6
-rw-r--r--dom/fetch/Request.h2
6 files changed, 36 insertions, 36 deletions
diff --git a/dom/fetch/Fetch.cpp b/dom/fetch/Fetch.cpp
index 04aa7fd91..4dbe2de0a 100644
--- a/dom/fetch/Fetch.cpp
+++ b/dom/fetch/Fetch.cpp
@@ -53,24 +53,24 @@ namespace dom {
using namespace workers;
-// This class helps the proxying of FetchSignal changes cross threads.
-class FetchSignalProxy final : public FetchSignal::Follower
+// This class helps the proxying of AbortSignal changes cross threads.
+class AbortSignalProxy final : public AbortSignal::Follower
{
// This is created and released on the main-thread.
- RefPtr<FetchSignal> mSignalMainThread;
+ RefPtr<AbortSignal> mSignalMainThread;
- // This value is used only for the creation of FetchSignal on the
+ // This value is used only for the creation of AbortSignal on the
// main-thread. They are not updated.
const bool mAborted;
- // This runnable propagates changes from the FetchSignal on workers to the
- // FetchSignal on main-thread.
- class FetchSignalProxyRunnable final : public Runnable
+ // This runnable propagates changes from the AbortSignal on workers to the
+ // AbortSignal on main-thread.
+ class AbortSignalProxyRunnable final : public Runnable
{
- RefPtr<FetchSignalProxy> mProxy;
+ RefPtr<AbortSignalProxy> mProxy;
public:
- explicit FetchSignalProxyRunnable(FetchSignalProxy* aProxy)
+ explicit AbortSignalProxyRunnable(AbortSignalProxy* aProxy)
: mProxy(aProxy)
{}
@@ -78,16 +78,16 @@ class FetchSignalProxy final : public FetchSignal::Follower
Run() override
{
MOZ_ASSERT(NS_IsMainThread());
- FetchSignal* signal = mProxy->GetOrCreateSignalForMainThread();
+ AbortSignal* signal = mProxy->GetOrCreateSignalForMainThread();
signal->Abort();
return NS_OK;
}
};
public:
- NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FetchSignalProxy)
+ NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AbortSignalProxy)
- explicit FetchSignalProxy(FetchSignal* aSignal)
+ explicit AbortSignalProxy(AbortSignal* aSignal)
: mAborted(aSignal->Aborted())
{
Follow(aSignal);
@@ -96,17 +96,17 @@ public:
void
Aborted() override
{
- RefPtr<FetchSignalProxyRunnable> runnable =
- new FetchSignalProxyRunnable(this);
+ RefPtr<AbortSignalProxyRunnable> runnable =
+ new AbortSignalProxyRunnable(this);
NS_DispatchToMainThread(runnable);
}
- FetchSignal*
+ AbortSignal*
GetOrCreateSignalForMainThread()
{
MOZ_ASSERT(NS_IsMainThread());
if (!mSignalMainThread) {
- mSignalMainThread = new FetchSignal(mAborted);
+ mSignalMainThread = new AbortSignal(mAborted);
}
return mSignalMainThread;
}
@@ -118,7 +118,7 @@ public:
}
private:
- ~FetchSignalProxy()
+ ~AbortSignalProxy()
{
NS_ReleaseOnMainThread(mSignalMainThread.forget());
}
@@ -133,14 +133,14 @@ class WorkerFetchResolver final : public FetchDriverObserver
friend class WorkerFetchResponseRunnable;
RefPtr<PromiseWorkerProxy> mPromiseProxy;
- RefPtr<FetchSignalProxy> mSignalProxy;
+ RefPtr<AbortSignalProxy> mSignalProxy;
RefPtr<FetchObserver> mFetchObserver;
public:
// Returns null if worker is shutting down.
static already_AddRefed<WorkerFetchResolver>
Create(workers::WorkerPrivate* aWorkerPrivate, Promise* aPromise,
- FetchSignal* aSignal, FetchObserver* aObserver)
+ AbortSignal* aSignal, FetchObserver* aObserver)
{
MOZ_ASSERT(aWorkerPrivate);
aWorkerPrivate->AssertIsOnWorkerThread();
@@ -150,9 +150,9 @@ public:
return nullptr;
}
- RefPtr<FetchSignalProxy> signalProxy;
+ RefPtr<AbortSignalProxy> signalProxy;
if (aSignal) {
- signalProxy = new FetchSignalProxy(aSignal);
+ signalProxy = new AbortSignalProxy(aSignal);
}
RefPtr<WorkerFetchResolver> r =
@@ -160,8 +160,8 @@ public:
return r.forget();
}
- FetchSignal*
- GetFetchSignal()
+ AbortSignal*
+ GetAbortSignal()
{
MOZ_ASSERT(NS_IsMainThread());
@@ -183,7 +183,7 @@ public:
private:
WorkerFetchResolver(PromiseWorkerProxy* aProxy,
- FetchSignalProxy* aSignalProxy,
+ AbortSignalProxy* aSignalProxy,
FetchObserver* aObserver)
: mPromiseProxy(aProxy)
, mSignalProxy(aSignalProxy)
@@ -287,7 +287,7 @@ public:
fetch->SetWorkerScript(spec);
}
- RefPtr<FetchSignal> signal = mResolver->GetFetchSignal();
+ RefPtr<AbortSignal> signal = mResolver->GetAbortSignal();
// ...but release it before calling Fetch, because mResolver's callback can
// be called synchronously and they want the mutex, too.
@@ -329,7 +329,7 @@ FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput,
RefPtr<InternalRequest> r = request->GetInternalRequest();
- RefPtr<FetchSignal> signal;
+ RefPtr<AbortSignal> signal;
if (aInit.mSignal.WasPassed()) {
signal = &aInit.mSignal.Value();
// Let's FetchDriver to deal with an already aborted signal.
diff --git a/dom/fetch/FetchDriver.cpp b/dom/fetch/FetchDriver.cpp
index e8d726ce1..067e32db4 100644
--- a/dom/fetch/FetchDriver.cpp
+++ b/dom/fetch/FetchDriver.cpp
@@ -67,7 +67,7 @@ FetchDriver::~FetchDriver()
}
nsresult
-FetchDriver::Fetch(FetchSignal* aSignal, FetchDriverObserver* aObserver)
+FetchDriver::Fetch(AbortSignal* aSignal, FetchDriverObserver* aObserver)
{
workers::AssertIsOnMainThread();
#ifdef DEBUG
diff --git a/dom/fetch/FetchDriver.h b/dom/fetch/FetchDriver.h
index e942aa242..57dffa5a7 100644
--- a/dom/fetch/FetchDriver.h
+++ b/dom/fetch/FetchDriver.h
@@ -12,7 +12,7 @@
#include "nsIStreamListener.h"
#include "nsIThreadRetargetableStreamListener.h"
#include "mozilla/ConsoleReportCollector.h"
-#include "mozilla/dom/FetchSignal.h"
+#include "mozilla/dom/AbortSignal.h"
#include "mozilla/dom/SRIMetadata.h"
#include "mozilla/RefPtr.h"
@@ -84,7 +84,7 @@ class FetchDriver final : public nsIStreamListener,
public nsIChannelEventSink,
public nsIInterfaceRequestor,
public nsIThreadRetargetableStreamListener,
- public FetchSignal::Follower
+ public AbortSignal::Follower
{
public:
NS_DECL_ISUPPORTS
@@ -98,7 +98,7 @@ public:
nsIPrincipal* aPrincipal,
nsILoadGroup* aLoadGroup);
- nsresult Fetch(FetchSignal* aSignal,
+ nsresult Fetch(AbortSignal* aSignal,
FetchDriverObserver* aObserver);
void
@@ -111,7 +111,7 @@ public:
mWorkerScript = aWorkerScirpt;
}
- // FetchSignal::Follower
+ // AbortSignal::Follower
void
Aborted() override;
diff --git a/dom/fetch/FetchObserver.cpp b/dom/fetch/FetchObserver.cpp
index 982f0ad49..93d93773f 100644
--- a/dom/fetch/FetchObserver.cpp
+++ b/dom/fetch/FetchObserver.cpp
@@ -46,7 +46,7 @@ FetchObserver::IsEnabled(JSContext* aCx, JSObject* aGlobal)
}
FetchObserver::FetchObserver(nsIGlobalObject* aGlobal,
- FetchSignal* aSignal)
+ AbortSignal* aSignal)
: DOMEventTargetHelper(aGlobal)
, mState(FetchState::Requesting)
{
diff --git a/dom/fetch/FetchObserver.h b/dom/fetch/FetchObserver.h
index 45adf2ba1..5cd835b3d 100644
--- a/dom/fetch/FetchObserver.h
+++ b/dom/fetch/FetchObserver.h
@@ -9,13 +9,13 @@
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/FetchObserverBinding.h"
-#include "mozilla/dom/FetchSignal.h"
+#include "mozilla/dom/AbortSignal.h"
namespace mozilla {
namespace dom {
class FetchObserver final : public DOMEventTargetHelper
- , public FetchSignal::Follower
+ , public AbortSignal::Follower
{
public:
NS_DECL_ISUPPORTS_INHERITED
@@ -24,7 +24,7 @@ public:
static bool
IsEnabled(JSContext* aCx, JSObject* aGlobal);
- FetchObserver(nsIGlobalObject* aGlobal, FetchSignal* aSignal);
+ FetchObserver(nsIGlobalObject* aGlobal, AbortSignal* aSignal);
JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
diff --git a/dom/fetch/Request.h b/dom/fetch/Request.h
index 56a75e5af..f6fe9be7b 100644
--- a/dom/fetch/Request.h
+++ b/dom/fetch/Request.h
@@ -12,7 +12,7 @@
#include "nsWrapperCache.h"
#include "mozilla/dom/Fetch.h"
-#include "mozilla/dom/FetchSignal.h"
+#include "mozilla/dom/AbortSignal.h"
#include "mozilla/dom/InternalRequest.h"
// Required here due to certain WebIDL enums/classes being declared in both
// files.