Issue #2676 - Implement AbortSignal.abort()

This commit is contained in:
Moonchild 2025-01-16 18:34:03 +01:00 committed by roytam1
commit 9fa4b6fd5d
3 changed files with 9 additions and 2 deletions

View file

@ -43,6 +43,12 @@ AbortSignal::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
return AbortSignalBinding::Wrap(aCx, this, aGivenProto);
}
already_AddRefed<AbortSignal> AbortSignal::Abort(GlobalObject& aGlobal) {
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
RefPtr<AbortSignal> abortSignal = new AbortSignal(global, true);
return abortSignal.forget();
}
bool
AbortSignal::Aborted() const
{

View file

@ -46,10 +46,10 @@ public:
bool
Aborted() const;
void
Abort();
void Abort();
IMPL_EVENT_HANDLER(abort);
static already_AddRefed<AbortSignal> Abort(GlobalObject& aGlobal);
void
AddFollower(Follower* aFollower);

View file

@ -7,6 +7,7 @@
[Exposed=(Window,Worker),
Func="AbortController::IsEnabled"]
interface AbortSignal : EventTarget {
[NewObject] static AbortSignal abort();
readonly attribute boolean aborted;
attribute EventHandler onabort;