summaryrefslogtreecommitdiffstats
path: root/dom/abort
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/abort
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/abort')
-rw-r--r--dom/abort/AbortController.cpp (renamed from dom/abort/FetchController.cpp)58
-rw-r--r--dom/abort/AbortController.h (renamed from dom/abort/FetchController.h)32
-rw-r--r--dom/abort/AbortSignal.cpp (renamed from dom/abort/FetchSignal.cpp)46
-rw-r--r--dom/abort/AbortSignal.h (renamed from dom/abort/FetchSignal.h)28
-rw-r--r--dom/abort/moz.build8
-rw-r--r--dom/abort/tests/file_abort_controller.html (renamed from dom/abort/tests/file_fetch_controller.html)0
-rw-r--r--dom/abort/tests/mochitest.ini4
-rw-r--r--dom/abort/tests/test_abort_controller.html (renamed from dom/abort/tests/test_fetch_controller.html)0
-rw-r--r--dom/abort/tests/worker_abort_controller.js (renamed from dom/abort/tests/worker_fetch_controller.js)4
9 files changed, 90 insertions, 90 deletions
diff --git a/dom/abort/FetchController.cpp b/dom/abort/AbortController.cpp
index 2eb40b980..4043b7bf3 100644
--- a/dom/abort/FetchController.cpp
+++ b/dom/abort/AbortController.cpp
@@ -4,30 +4,30 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include "FetchController.h"
-#include "FetchSignal.h"
-#include "mozilla/dom/FetchControllerBinding.h"
+#include "AbortController.h"
+#include "AbortSignal.h"
+#include "mozilla/dom/AbortControllerBinding.h"
#include "WorkerPrivate.h"
namespace mozilla {
namespace dom {
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(FetchController, mGlobal, mSignal,
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(AbortController, mGlobal, mSignal,
mFollowingSignal)
-NS_IMPL_CYCLE_COLLECTING_ADDREF(FetchController)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(FetchController)
+NS_IMPL_CYCLE_COLLECTING_ADDREF(AbortController)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(AbortController)
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FetchController)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AbortController)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
/* static */ bool
-FetchController::IsEnabled(JSContext* aCx, JSObject* aGlobal)
+AbortController::IsEnabled(JSContext* aCx, JSObject* aGlobal)
{
if (NS_IsMainThread()) {
- return Preferences::GetBool("dom.fetchController.enabled", false);
+ return Preferences::GetBool("dom.abortController.enabled", false);
}
using namespace workers;
@@ -38,11 +38,11 @@ FetchController::IsEnabled(JSContext* aCx, JSObject* aGlobal)
return false;
}
- return workerPrivate->FetchControllerEnabled();
+ return workerPrivate->AbortControllerEnabled();
}
-/* static */ already_AddRefed<FetchController>
-FetchController::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
+/* static */ already_AddRefed<AbortController>
+AbortController::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
{
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
if (!global) {
@@ -50,39 +50,39 @@ FetchController::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
return nullptr;
}
- RefPtr<FetchController> fetchController = new FetchController(global);
- return fetchController.forget();
+ RefPtr<AbortController> abortController = new AbortController(global);
+ return abortController.forget();
}
-FetchController::FetchController(nsIGlobalObject* aGlobal)
+AbortController::AbortController(nsIGlobalObject* aGlobal)
: mGlobal(aGlobal)
, mAborted(false)
{}
JSObject*
-FetchController::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
+AbortController::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
- return FetchControllerBinding::Wrap(aCx, this, aGivenProto);
+ return AbortControllerBinding::Wrap(aCx, this, aGivenProto);
}
nsIGlobalObject*
-FetchController::GetParentObject() const
+AbortController::GetParentObject() const
{
return mGlobal;
}
-FetchSignal*
-FetchController::Signal()
+AbortSignal*
+AbortController::Signal()
{
if (!mSignal) {
- mSignal = new FetchSignal(this, mAborted);
+ mSignal = new AbortSignal(this, mAborted);
}
return mSignal;
}
void
-FetchController::Abort()
+AbortController::Abort()
{
if (mAborted) {
return;
@@ -96,29 +96,29 @@ FetchController::Abort()
}
void
-FetchController::Follow(FetchSignal& aSignal)
+AbortController::Follow(AbortSignal& aSignal)
{
- FetchSignal::Follower::Follow(&aSignal);
+ AbortSignal::Follower::Follow(&aSignal);
}
void
-FetchController::Unfollow(FetchSignal& aSignal)
+AbortController::Unfollow(AbortSignal& aSignal)
{
if (mFollowingSignal != &aSignal) {
return;
}
- FetchSignal::Follower::Unfollow();
+ AbortSignal::Follower::Unfollow();
}
-FetchSignal*
-FetchController::Following() const
+AbortSignal*
+AbortController::Following() const
{
return mFollowingSignal;
}
void
-FetchController::Aborted()
+AbortController::Aborted()
{
Abort();
}
diff --git a/dom/abort/FetchController.h b/dom/abort/AbortController.h
index 7a0132dca..9ce4253c9 100644
--- a/dom/abort/FetchController.h
+++ b/dom/abort/AbortController.h
@@ -4,11 +4,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#ifndef mozilla_dom_FetchController_h
-#define mozilla_dom_FetchController_h
+#ifndef mozilla_dom_AbortController_h
+#define mozilla_dom_AbortController_h
#include "mozilla/dom/BindingDeclarations.h"
-#include "mozilla/dom/FetchSignal.h"
+#include "mozilla/dom/AbortSignal.h"
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
#include "mozilla/ErrorResult.h"
@@ -17,21 +17,21 @@
namespace mozilla {
namespace dom {
-class FetchController final : public nsISupports
+class AbortController final : public nsISupports
, public nsWrapperCache
- , public FetchSignal::Follower
+ , public AbortSignal::Follower
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
- NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(FetchController)
+ NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(AbortController)
static bool
IsEnabled(JSContext* aCx, JSObject* aGlobal);
- static already_AddRefed<FetchController>
+ static already_AddRefed<AbortController>
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
- explicit FetchController(nsIGlobalObject* aGlobal);
+ explicit AbortController(nsIGlobalObject* aGlobal);
JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
@@ -39,30 +39,30 @@ public:
nsIGlobalObject*
GetParentObject() const;
- FetchSignal*
+ AbortSignal*
Signal();
void
Abort();
void
- Follow(FetchSignal& aSignal);
+ Follow(AbortSignal& aSignal);
void
- Unfollow(FetchSignal& aSignal);
+ Unfollow(AbortSignal& aSignal);
- FetchSignal*
+ AbortSignal*
Following() const;
- // FetchSignal::Follower
+ // AbortSignal::Follower
void Aborted() override;
private:
- ~FetchController() = default;
+ ~AbortController() = default;
nsCOMPtr<nsIGlobalObject> mGlobal;
- RefPtr<FetchSignal> mSignal;
+ RefPtr<AbortSignal> mSignal;
bool mAborted;
};
@@ -70,4 +70,4 @@ private:
} // dom namespace
} // mozilla namespace
-#endif // mozilla_dom_FetchController_h
+#endif // mozilla_dom_AbortController_h
diff --git a/dom/abort/FetchSignal.cpp b/dom/abort/AbortSignal.cpp
index 07ad6b53d..38b0a2492 100644
--- a/dom/abort/FetchSignal.cpp
+++ b/dom/abort/AbortSignal.cpp
@@ -4,57 +4,57 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include "FetchSignal.h"
-#include "FetchController.h"
+#include "AbortSignal.h"
+#include "AbortController.h"
#include "mozilla/dom/Event.h"
-#include "mozilla/dom/FetchSignalBinding.h"
+#include "mozilla/dom/AbortSignalBinding.h"
namespace mozilla {
namespace dom {
-NS_IMPL_CYCLE_COLLECTION_CLASS(FetchSignal)
+NS_IMPL_CYCLE_COLLECTION_CLASS(AbortSignal)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(FetchSignal,
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(AbortSignal,
DOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mController)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(FetchSignal,
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(AbortSignal,
DOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mController)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FetchSignal)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(AbortSignal)
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
-NS_IMPL_ADDREF_INHERITED(FetchSignal, DOMEventTargetHelper)
-NS_IMPL_RELEASE_INHERITED(FetchSignal, DOMEventTargetHelper)
+NS_IMPL_ADDREF_INHERITED(AbortSignal, DOMEventTargetHelper)
+NS_IMPL_RELEASE_INHERITED(AbortSignal, DOMEventTargetHelper)
-FetchSignal::FetchSignal(FetchController* aController,
+AbortSignal::AbortSignal(AbortController* aController,
bool aAborted)
: DOMEventTargetHelper(aController->GetParentObject())
, mController(aController)
, mAborted(aAborted)
{}
-FetchSignal::FetchSignal(bool aAborted)
+AbortSignal::AbortSignal(bool aAborted)
: mAborted(aAborted)
{}
JSObject*
-FetchSignal::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
+AbortSignal::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
- return FetchSignalBinding::Wrap(aCx, this, aGivenProto);
+ return AbortSignalBinding::Wrap(aCx, this, aGivenProto);
}
bool
-FetchSignal::Aborted() const
+AbortSignal::Aborted() const
{
return mAborted;
}
void
-FetchSignal::Abort()
+AbortSignal::Abort()
{
MOZ_ASSERT(!mAborted);
mAborted = true;
@@ -79,7 +79,7 @@ FetchSignal::Abort()
}
void
-FetchSignal::AddFollower(FetchSignal::Follower* aFollower)
+AbortSignal::AddFollower(AbortSignal::Follower* aFollower)
{
MOZ_DIAGNOSTIC_ASSERT(aFollower);
if (!mFollowers.Contains(aFollower)) {
@@ -88,14 +88,14 @@ FetchSignal::AddFollower(FetchSignal::Follower* aFollower)
}
void
-FetchSignal::RemoveFollower(FetchSignal::Follower* aFollower)
+AbortSignal::RemoveFollower(AbortSignal::Follower* aFollower)
{
MOZ_DIAGNOSTIC_ASSERT(aFollower);
mFollowers.RemoveElement(aFollower);
}
bool
-FetchSignal::CanAcceptFollower(FetchSignal::Follower* aFollower) const
+AbortSignal::CanAcceptFollower(AbortSignal::Follower* aFollower) const
{
MOZ_DIAGNOSTIC_ASSERT(aFollower);
@@ -107,7 +107,7 @@ FetchSignal::CanAcceptFollower(FetchSignal::Follower* aFollower) const
return false;
}
- FetchSignal* following = mController->Following();
+ AbortSignal* following = mController->Following();
if (!following) {
return true;
}
@@ -115,16 +115,16 @@ FetchSignal::CanAcceptFollower(FetchSignal::Follower* aFollower) const
return following->CanAcceptFollower(aFollower);
}
-// FetchSignal::Follower
+// AbortSignal::Follower
// ----------------------------------------------------------------------------
-FetchSignal::Follower::~Follower()
+AbortSignal::Follower::~Follower()
{
Unfollow();
}
void
-FetchSignal::Follower::Follow(FetchSignal* aSignal)
+AbortSignal::Follower::Follow(AbortSignal* aSignal)
{
MOZ_DIAGNOSTIC_ASSERT(aSignal);
@@ -139,7 +139,7 @@ FetchSignal::Follower::Follow(FetchSignal* aSignal)
}
void
-FetchSignal::Follower::Unfollow()
+AbortSignal::Follower::Unfollow()
{
if (mFollowingSignal) {
mFollowingSignal->RemoveFollower(this);
diff --git a/dom/abort/FetchSignal.h b/dom/abort/AbortSignal.h
index 4970f03de..c5045dbd6 100644
--- a/dom/abort/FetchSignal.h
+++ b/dom/abort/AbortSignal.h
@@ -4,21 +4,21 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#ifndef mozilla_dom_FetchSignal_h
-#define mozilla_dom_FetchSignal_h
+#ifndef mozilla_dom_AbortSignal_h
+#define mozilla_dom_AbortSignal_h
#include "mozilla/DOMEventTargetHelper.h"
namespace mozilla {
namespace dom {
-class FetchController;
-class FetchSignal;
+class AbortController;
+class AbortSignal;
-class FetchSignal final : public DOMEventTargetHelper
+class AbortSignal final : public DOMEventTargetHelper
{
public:
- // This class must be implemented by objects who want to follow a FetchSignal.
+ // This class must be implemented by objects who want to follow a AbortSignal.
class Follower
{
public:
@@ -28,19 +28,19 @@ public:
virtual ~Follower();
void
- Follow(FetchSignal* aSignal);
+ Follow(AbortSignal* aSignal);
void
Unfollow();
- RefPtr<FetchSignal> mFollowingSignal;
+ RefPtr<AbortSignal> mFollowingSignal;
};
NS_DECL_ISUPPORTS_INHERITED
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FetchSignal, DOMEventTargetHelper)
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AbortSignal, DOMEventTargetHelper)
- FetchSignal(FetchController* aController, bool aAborted);
- explicit FetchSignal(bool aAborted);
+ AbortSignal(AbortController* aController, bool aAborted);
+ explicit AbortSignal(bool aAborted);
JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
@@ -63,9 +63,9 @@ public:
CanAcceptFollower(Follower* aFollower) const;
private:
- ~FetchSignal() = default;
+ ~AbortSignal() = default;
- RefPtr<FetchController> mController;
+ RefPtr<AbortController> mController;
// Raw pointers. Follower unregisters itself in the DTOR.
nsTArray<Follower*> mFollowers;
@@ -76,4 +76,4 @@ private:
} // dom namespace
} // mozilla namespace
-#endif // mozilla_dom_FetchSignal_h
+#endif // mozilla_dom_AbortSignal_h
diff --git a/dom/abort/moz.build b/dom/abort/moz.build
index e7d8146e5..cb48ee15f 100644
--- a/dom/abort/moz.build
+++ b/dom/abort/moz.build
@@ -10,13 +10,13 @@ with Files("**"):
TEST_DIRS += ['tests']
EXPORTS.mozilla.dom += [
- 'FetchController.h',
- 'FetchSignal.h',
+ 'AbortController.h',
+ 'AbortSignal.h',
]
UNIFIED_SOURCES += [
- 'FetchController.cpp',
- 'FetchSignal.cpp',
+ 'AbortController.cpp',
+ 'AbortSignal.cpp',
]
LOCAL_INCLUDES += [
diff --git a/dom/abort/tests/file_fetch_controller.html b/dom/abort/tests/file_abort_controller.html
index e4137aac9..e4137aac9 100644
--- a/dom/abort/tests/file_fetch_controller.html
+++ b/dom/abort/tests/file_abort_controller.html
diff --git a/dom/abort/tests/mochitest.ini b/dom/abort/tests/mochitest.ini
index 5ecc7048e..c8cc95fda 100644
--- a/dom/abort/tests/mochitest.ini
+++ b/dom/abort/tests/mochitest.ini
@@ -1,6 +1,6 @@
[DEFAULT]
support-files =
- file_fetch_controller.html
+ file_abort_controller.html
worker_fetch_controller.js
-[test_fetch_controller.html]
+[test_abort_controller.html]
diff --git a/dom/abort/tests/test_fetch_controller.html b/dom/abort/tests/test_abort_controller.html
index 812fb9161..812fb9161 100644
--- a/dom/abort/tests/test_fetch_controller.html
+++ b/dom/abort/tests/test_abort_controller.html
diff --git a/dom/abort/tests/worker_fetch_controller.js b/dom/abort/tests/worker_abort_controller.js
index 6b008fea8..6fd1c7888 100644
--- a/dom/abort/tests/worker_fetch_controller.js
+++ b/dom/abort/tests/worker_abort_controller.js
@@ -1,5 +1,5 @@
function testWorkerAbortedFetch() {
- var fc = new FetchController();
+ var fc = new AbortController();
fc.abort();
fetch('slow.sjs', { signal: fc.signal }).then(() => {
@@ -10,7 +10,7 @@ function testWorkerAbortedFetch() {
}
function testWorkerFetchAndAbort() {
- var fc = new FetchController();
+ var fc = new AbortController();
var p = fetch('slow.sjs', { signal: fc.signal });
fc.abort();