ServiceWorkerUnregisterJob.h (1275B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_serviceworkerunregisterjob_h 8 #define mozilla_dom_serviceworkerunregisterjob_h 9 10 #include "ServiceWorkerJob.h" 11 12 namespace mozilla { 13 template <typename ResolveValueT, typename RejectValueT, bool IsExclusive> 14 class MozPromise; 15 using GenericPromise = MozPromise<bool, nsresult, /* IsExclusive = */ true>; 16 } // namespace mozilla 17 18 namespace mozilla::dom { 19 20 class ServiceWorkerUnregisterJob final : public ServiceWorkerJob { 21 public: 22 ServiceWorkerUnregisterJob(nsIPrincipal* aPrincipal, 23 const nsACString& aScope); 24 25 bool GetResult() const; 26 27 private: 28 class PushUnsubscribeCallback; 29 30 virtual ~ServiceWorkerUnregisterJob(); 31 32 already_AddRefed<GenericPromise> ClearNotifications(); 33 already_AddRefed<GenericPromise> ClearPushSubscriptions(); 34 35 void AsyncExecute() override; 36 37 void Unregister(); 38 39 bool mResult; 40 }; 41 42 } // namespace mozilla::dom 43 44 #endif // mozilla_dom_serviceworkerunregisterjob_h