diff options
Diffstat (limited to 'dom')
-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.build | 8 | ||||
-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.ini | 4 | ||||
-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 | ||||
-rw-r--r-- | dom/fetch/Fetch.cpp | 52 | ||||
-rw-r--r-- | dom/fetch/FetchDriver.cpp | 2 | ||||
-rw-r--r-- | dom/fetch/FetchDriver.h | 8 | ||||
-rw-r--r-- | dom/fetch/FetchObserver.cpp | 2 | ||||
-rw-r--r-- | dom/fetch/FetchObserver.h | 6 | ||||
-rw-r--r-- | dom/fetch/Request.h | 2 | ||||
-rw-r--r-- | dom/tests/mochitest/fetch/file_fetch_observer.html | 8 | ||||
-rw-r--r-- | dom/webidl/AbortController.webidl (renamed from dom/webidl/FetchController.webidl) | 10 | ||||
-rw-r--r-- | dom/webidl/AbortSignal.webidl (renamed from dom/webidl/FetchSignal.webidl) | 4 | ||||
-rw-r--r-- | dom/webidl/Request.webidl | 4 | ||||
-rw-r--r-- | dom/webidl/moz.build | 4 | ||||
-rw-r--r-- | dom/workers/WorkerPrefs.h | 2 |
21 files changed, 142 insertions, 142 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(); 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. diff --git a/dom/tests/mochitest/fetch/file_fetch_observer.html b/dom/tests/mochitest/fetch/file_fetch_observer.html index a172a18dc..668e609ec 100644 --- a/dom/tests/mochitest/fetch/file_fetch_observer.html +++ b/dom/tests/mochitest/fetch/file_fetch_observer.html @@ -19,7 +19,7 @@ function testObserver() { } function testObserveAbort() { - var fc = new FetchController(); + var fc = new AbortController(); fetch('http://mochi.test:8888/tests/dom/tests/mochitest/fetch/slow.sjs', { signal: fc.signal, @@ -37,7 +37,7 @@ function testObserveAbort() { } function testObserveComplete() { - var fc = new FetchController(); + var fc = new AbortController(); fetch('http://mochi.test:8888/tests/dom/tests/mochitest/fetch/slow.sjs', { signal: fc.signal, @@ -54,7 +54,7 @@ function testObserveComplete() { } function testObserveErrored() { - var fc = new FetchController(); + var fc = new AbortController(); fetch('foo: bar', { signal: fc.signal, @@ -71,7 +71,7 @@ function testObserveErrored() { } function testObserveResponding() { - var fc = new FetchController(); + var fc = new AbortController(); fetch('http://mochi.test:8888/tests/dom/tests/mochitest/fetch/slow.sjs', { signal: fc.signal, diff --git a/dom/webidl/FetchController.webidl b/dom/webidl/AbortController.webidl index c5b1cc6da..f5d8f317b 100644 --- a/dom/webidl/FetchController.webidl +++ b/dom/webidl/AbortController.webidl @@ -5,11 +5,11 @@ */ [Constructor(), Exposed=(Window,Worker), - Func="FetchController::IsEnabled"] -interface FetchController { - readonly attribute FetchSignal signal; + Func="AbortController::IsEnabled"] +interface AbortController { + readonly attribute AbortSignal signal; void abort(); - void follow(FetchSignal signal); - void unfollow(FetchSignal signal); + void follow(AbortSignal signal); + void unfollow(AbortSignal signal); }; diff --git a/dom/webidl/FetchSignal.webidl b/dom/webidl/AbortSignal.webidl index 965355c20..b4b03bb7e 100644 --- a/dom/webidl/FetchSignal.webidl +++ b/dom/webidl/AbortSignal.webidl @@ -5,8 +5,8 @@ */ [Exposed=(Window,Worker), - Func="FetchController::IsEnabled"] -interface FetchSignal : EventTarget { + Func="AbortController::IsEnabled"] +interface AbortSignal : EventTarget { readonly attribute boolean aborted; attribute EventHandler onabort; diff --git a/dom/webidl/Request.webidl b/dom/webidl/Request.webidl index 8c6e33da3..fe6a63ec0 100644 --- a/dom/webidl/Request.webidl +++ b/dom/webidl/Request.webidl @@ -48,8 +48,8 @@ dictionary RequestInit { RequestRedirect redirect; DOMString integrity; - [Func="FetchController::IsEnabled"] - FetchSignal signal; + [Func="AbortController::IsEnabled"] + AbortSignal signal; [Func="FetchObserver::IsEnabled"] ObserverCallback observe; diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index 0963e3d01..d8309c265 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -17,6 +17,8 @@ PREPROCESSED_WEBIDL_FILES = [ ] WEBIDL_FILES = [ + 'AbortController.webidl', + 'AbortSignal.webidl', 'AbstractWorker.webidl', 'AnalyserNode.webidl', 'Animatable.webidl', @@ -141,10 +143,8 @@ WEBIDL_FILES = [ 'ExtendableMessageEvent.webidl', 'FakePluginTagInit.webidl', 'Fetch.webidl', - 'FetchController.webidl', 'FetchEvent.webidl', 'FetchObserver.webidl', - 'FetchSignal.webidl', 'File.webidl', 'FileList.webidl', 'FileMode.webidl', diff --git a/dom/workers/WorkerPrefs.h b/dom/workers/WorkerPrefs.h index 374f41ecf..b552d8956 100644 --- a/dom/workers/WorkerPrefs.h +++ b/dom/workers/WorkerPrefs.h @@ -39,7 +39,7 @@ WORKER_SIMPLE_PREF("dom.push.enabled", PushEnabled, PUSH_ENABLED) WORKER_SIMPLE_PREF("dom.requestcontext.enabled", RequestContextEnabled, REQUESTCONTEXT_ENABLED) WORKER_SIMPLE_PREF("gfx.offscreencanvas.enabled", OffscreenCanvasEnabled, OFFSCREENCANVAS_ENABLED) WORKER_SIMPLE_PREF("dom.webkitBlink.dirPicker.enabled", WebkitBlinkDirectoryPickerEnabled, DOM_WEBKITBLINK_DIRPICKER_WEBKITBLINK) -WORKER_SIMPLE_PREF("dom.fetchController.enabled", FetchControllerEnabled, FETCHCONTROLLER_ENABLED) +WORKER_SIMPLE_PREF("dom.abortController.enabled", AbortControllerEnabled, ABORTCONTROLLER_ENABLED) WORKER_SIMPLE_PREF("dom.fetchObserver.enabled", FetchObserverEnabled, FETCHOBSERVER_ENABLED) WORKER_PREF("dom.workers.latestJSVersion", JSVersionChanged) WORKER_PREF("intl.accept_languages", PrefLanguagesChanged) |