script: implement AbortController (#31361)

* Implement AbortController

Signed-off-by: syvb <me@iter.ca>

* Update WPT tests

Signed-off-by: syvb <me@iter.ca>

* Address review comments

* Fix duplicate import generation

* Update WPT test expectations

* Change expectation to FAIL for flaky test

---------

Signed-off-by: syvb <me@iter.ca>
This commit is contained in:
Smitty 2024-05-04 11:00:01 -04:00 committed by GitHub
parent 383607d01e
commit 7fce850cff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
88 changed files with 522 additions and 1194 deletions

View file

@ -0,0 +1,13 @@
/* 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 https://mozilla.org/MPL/2.0/. */
// https://dom.spec.whatwg.org/#interface-abortcontroller
[Exposed=*]
interface AbortController {
constructor();
[SameObject] readonly attribute AbortSignal signal;
undefined abort(optional any reason);
};

View file

@ -0,0 +1,17 @@
/* 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 https://mozilla.org/MPL/2.0/. */
// https://dom.spec.whatwg.org/#interface-AbortSignal
[Exposed=*]
interface AbortSignal : EventTarget {
// [NewObject] static AbortSignal abort(optional any reason);
// [Exposed=(Window,Worker), NewObject] static AbortSignal timeout([EnforceRange] unsigned long long milliseconds);
// [NewObject] static AbortSignal _any(sequence<AbortSignal> signals);
readonly attribute boolean aborted;
readonly attribute any reason;
undefined throwIfAborted();
attribute EventHandler onabort;
};

View file

@ -31,4 +31,5 @@ dictionary EventListenerOptions {
dictionary AddEventListenerOptions : EventListenerOptions {
// boolean passive = false;
boolean once = false;
AbortSignal signal;
};