2017-03-22 13:04:57 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* 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/. */
|
|
|
|
|
2017-08-29 12:31:06 +03:00
|
|
|
#ifndef mozilla_dom_AbortController_h
|
|
|
|
#define mozilla_dom_AbortController_h
|
2017-03-22 13:04:57 +03:00
|
|
|
|
|
|
|
#include "mozilla/dom/BindingDeclarations.h"
|
2017-08-29 12:31:06 +03:00
|
|
|
#include "mozilla/ErrorResult.h"
|
2017-03-22 13:04:57 +03:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
|
2017-08-29 12:31:06 +03:00
|
|
|
class nsIGlobalObject;
|
|
|
|
|
2017-03-22 13:04:57 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2017-08-29 12:31:06 +03:00
|
|
|
class AbortSignal;
|
|
|
|
|
2017-08-29 12:31:06 +03:00
|
|
|
class AbortController final : public nsISupports, public nsWrapperCache {
|
2017-03-22 13:04:57 +03:00
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2017-08-29 12:31:06 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(AbortController)
|
2017-03-22 13:04:57 +03:00
|
|
|
|
2017-08-29 12:31:06 +03:00
|
|
|
static already_AddRefed<AbortController> Constructor(
|
2017-03-22 13:04:57 +03:00
|
|
|
const GlobalObject& aGlobal, ErrorResult& aRv);
|
|
|
|
|
2017-08-29 12:31:06 +03:00
|
|
|
explicit AbortController(nsIGlobalObject* aGlobal);
|
2017-03-22 13:04:57 +03:00
|
|
|
|
|
|
|
JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
|
|
|
nsIGlobalObject* GetParentObject() const;
|
|
|
|
|
2017-08-29 12:31:06 +03:00
|
|
|
AbortSignal* Signal();
|
2017-03-22 13:04:57 +03:00
|
|
|
|
|
|
|
void Abort();
|
|
|
|
|
|
|
|
private:
|
2017-08-29 12:31:06 +03:00
|
|
|
~AbortController() = default;
|
2017-03-22 13:04:57 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIGlobalObject> mGlobal;
|
2017-08-29 12:31:06 +03:00
|
|
|
RefPtr<AbortSignal> mSignal;
|
2017-03-22 13:04:57 +03:00
|
|
|
|
|
|
|
bool mAborted;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2017-08-29 12:31:06 +03:00
|
|
|
#endif // mozilla_dom_AbortController_h
|