Bug 1879449 [wpt PR 44489] - [wptrunner] Add `infrastructure/expected-fail/` test...
[gecko.git] / dom / abort / AbortController.h
blob0af33453cfa2ae55ac3c2fd32c87405410e05274
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/. */
7 #ifndef mozilla_dom_AbortController_h
8 #define mozilla_dom_AbortController_h
10 #include "mozilla/dom/BindingDeclarations.h"
11 #include "nsCOMPtr.h"
12 #include "nsCycleCollectionParticipant.h"
13 #include "nsWrapperCache.h"
15 class nsIGlobalObject;
17 namespace mozilla {
18 class ErrorResult;
20 namespace dom {
22 class AbortSignal;
24 class AbortController : public nsISupports, public nsWrapperCache {
25 public:
26 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
27 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(AbortController)
29 static already_AddRefed<AbortController> Constructor(
30 const GlobalObject& aGlobal, ErrorResult& aRv);
32 explicit AbortController(nsIGlobalObject* aGlobal);
34 JSObject* WrapObject(JSContext* aCx,
35 JS::Handle<JSObject*> aGivenProto) override;
37 nsIGlobalObject* GetParentObject() const;
39 AbortSignal* Signal();
41 void Abort(JSContext* aCx, JS::Handle<JS::Value> aReason);
43 protected:
44 virtual ~AbortController();
46 nsCOMPtr<nsIGlobalObject> mGlobal;
47 RefPtr<AbortSignal> mSignal;
49 bool mAborted;
50 JS::Heap<JS::Value> mReason;
53 } // namespace dom
54 } // namespace mozilla
56 #endif // mozilla_dom_AbortController_h