1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2/* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6enum DOMRequestReadyState { "pending", "done" }; 7 8[Exposed=(Window,Worker)] 9interface mixin DOMRequestShared { 10 readonly attribute DOMRequestReadyState readyState; 11 12 readonly attribute any result; 13 readonly attribute DOMException? error; 14 15 attribute EventHandler onsuccess; 16 attribute EventHandler onerror; 17}; 18 19[Exposed=(Window,Worker)] 20interface DOMRequest : EventTarget { 21 // The [TreatNonCallableAsNull] annotation is required since then() should do 22 // nothing instead of throwing errors when non-callable arguments are passed. 23 // See documentation for Promise.then to see why we return "any". 24 [NewObject, Throws] 25 any then([TreatNonCallableAsNull] optional AnyCallback? fulfillCallback = null, 26 [TreatNonCallableAsNull] optional AnyCallback? rejectCallback = null); 27 28 [ChromeOnly] 29 void fireDetailedError(DOMException aError); 30}; 31 32DOMRequest includes DOMRequestShared; 33