From 9513d94ebe710b4e962fad0917f616e51ce150d5 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Wed, 17 May 2017 11:09:59 +0200 Subject: [PATCH] DOM: AbortController and AbortSignal For https://github.com/whatwg/dom/pull/437. --- dom/interface-objects.html | 2 ++ dom/interfaces.html | 2 ++ interfaces/dom.idl | 19 ++++++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/dom/interface-objects.html b/dom/interface-objects.html index df4ca51e47777a..936d63517eada5 100644 --- a/dom/interface-objects.html +++ b/dom/interface-objects.html @@ -15,6 +15,8 @@ "Event", "CustomEvent", "EventTarget", + "AbortController", + "AbortSignal", "Node", "Document", "DOMImplementation", diff --git a/dom/interfaces.html b/dom/interfaces.html index e6b12e3cbd4c5f..f42af90854507b 100644 --- a/dom/interfaces.html +++ b/dom/interfaces.html @@ -23,6 +23,8 @@

DOM IDL tests

idlArray.add_objects({ 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'], diff --git a/interfaces/dom.idl b/interfaces/dom.idl index 7e2667ff7d3593..dcbf0315518494 100644 --- a/interfaces/dom.idl +++ b/interfaces/dom.idl @@ -44,7 +44,7 @@ dictionary CustomEventInit : EventInit { }; -//[Exposed=(Window,Worker)] +[Exposed=(Window,Worker)] interface EventTarget { void addEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options); void removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options); @@ -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 {