Skip to content

Commit

Permalink
DOM: AbortController and AbortSignal
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk authored Jul 14, 2017
1 parent f90eada commit eb84ee6
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
22 changes: 22 additions & 0 deletions dom/abort/event.any.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
test(t => {
const c = new AbortController(),
s = c.signal;
let state = "begin";

assert_false(s.aborted);

s.addEventListener("abort",
t.step_func(e => {
assert_equals(state, "begin");
state = "aborted";
})
);
c.abort();

assert_equals(state, "aborted");
assert_true(s.aborted);

c.abort();
}, "AbortController() basics");

done();
2 changes: 2 additions & 0 deletions dom/interface-objects.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"Event",
"CustomEvent",
"EventTarget",
"AbortController",
"AbortSignal",
"Node",
"Document",
"DOMImplementation",
Expand Down
2 changes: 2 additions & 0 deletions dom/interfaces.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ <h1>DOM IDL tests</h1>
EventTarget: ['new EventTarget()'],
Event: ['document.createEvent("Event")', 'new Event("foo")'],
CustomEvent: ['new CustomEvent("foo")'],
AbortController: ['new AbortController()'],
AbortSignal: ['new AbortController().signal'],
Document: ['new Document()'],
XMLDocument: ['xmlDoc'],
DOMImplementation: ['document.implementation'],
Expand Down
17 changes: 17 additions & 0 deletions interfaces/dom.idl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,23 @@ dictionary EventListenerOptions {
};


[Constructor,
Exposed=(Window,Worker)]
interface AbortController {
[SameObject] readonly attribute AbortSignal signal;

void abort();
};


[Exposed=(Window,Worker)]
interface AbortSignal : EventTarget {
readonly attribute boolean aborted;

attribute EventHandler onabort;
};


[NoInterfaceObject,
Exposed=Window]
interface NonElementParentNode {
Expand Down

0 comments on commit eb84ee6

Please sign in to comment.