diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-12-19 01:35:24 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-12-19 01:35:24 +0100 |
commit | fb96b43b5f6188233710c5f8c9c9e46baa9cb369 (patch) | |
tree | 54124a46275f833ecd9f6e63246e092a93843fb0 /dom/webidl | |
parent | 8220776c9b2e8291f0414f98ac20fbda30e00d2e (diff) | |
download | UXP-fb96b43b5f6188233710c5f8c9c9e46baa9cb369.tar UXP-fb96b43b5f6188233710c5f8c9c9e46baa9cb369.tar.gz UXP-fb96b43b5f6188233710c5f8c9c9e46baa9cb369.tar.lz UXP-fb96b43b5f6188233710c5f8c9c9e46baa9cb369.tar.xz UXP-fb96b43b5f6188233710c5f8c9c9e46baa9cb369.zip |
Issue #1322 - Part 1: Remove the DOM Promise guts.
This removes all the parts guarded by SPIDERMONKEY_PROMISE
Diffstat (limited to 'dom/webidl')
-rw-r--r-- | dom/webidl/Promise.webidl | 48 | ||||
-rw-r--r-- | dom/webidl/PromiseDebugging.webidl | 44 | ||||
-rw-r--r-- | dom/webidl/moz.build | 4 |
3 files changed, 4 insertions, 92 deletions
diff --git a/dom/webidl/Promise.webidl b/dom/webidl/Promise.webidl index 4dcb7d43e..65b406b6f 100644 --- a/dom/webidl/Promise.webidl +++ b/dom/webidl/Promise.webidl @@ -17,51 +17,8 @@ callback PromiseJobCallback = void(); [TreatNonCallableAsNull] callback AnyCallback = any (any value); -// When using SpiderMonkey promises, we don't want to define all this stuff; -// just define a tiny interface to make codegen of Promise arguments and return -// values work. -#ifndef SPIDERMONKEY_PROMISE -[Constructor(PromiseInit init), - Exposed=(Window,Worker,WorkerDebugger,System)] -// Need to escape "Promise" so it's treated as an identifier. -interface _Promise { - // Have to use "any" (or "object", but "any" is simpler) as the type to - // support the subclassing behavior, since nothing actually requires the - // return value of PromiseSubclass.resolve/reject to be a Promise object. - [NewObject, Throws] - static any resolve(optional any value); - [NewObject, Throws] - static any reject(optional any value); - - // The [TreatNonCallableAsNull] annotation is required since then() should do - // nothing instead of throwing errors when non-callable arguments are passed. - // Have to use "any" (or "object", but "any" is simpler) as the type to - // support the subclassing behavior, since nothing actually requires the - // return value of PromiseSubclass.then/catch to be a Promise object. - [NewObject, Throws] - any then([TreatNonCallableAsNull] optional AnyCallback? fulfillCallback = null, - [TreatNonCallableAsNull] optional AnyCallback? rejectCallback = null); - - [NewObject, Throws] - any catch([TreatNonCallableAsNull] optional AnyCallback? rejectCallback = null); - - // Have to use "any" (or "object", but "any" is simpler) as the type to - // support the subclassing behavior, since nothing actually requires the - // return value of PromiseSubclass.all to be a Promise object. As a result, - // we also have to do our argument conversion manually, because we want to - // convert its exceptions into rejections. - [NewObject, Throws] - static any all(optional any iterable); - - // Have to use "any" (or "object", but "any" is simpler) as the type to - // support the subclassing behavior, since nothing actually requires the - // return value of PromiseSubclass.race to be a Promise object. As a result, - // we also have to do our argument conversion manually, because we want to - // convert its exceptions into rejections. - [NewObject, Throws] - static any race(optional any iterable); -}; -#else // SPIDERMONKEY_PROMISE +// Promises are implemented in SpiderMonkey; just define a tiny interface to make +// codegen of Promise arguments and return values work. [NoInterfaceObject, Exposed=(Window,Worker,WorkerDebugger,System)] // Need to escape "Promise" so it's treated as an identifier. @@ -74,4 +31,3 @@ interface _Promise { Exposed=(Window,Worker,System)] interface PromiseNativeHandler { }; -#endif // SPIDERMONKEY_PROMISE diff --git a/dom/webidl/PromiseDebugging.webidl b/dom/webidl/PromiseDebugging.webidl index 107b8bc65..1a5c1aa32 100644 --- a/dom/webidl/PromiseDebugging.webidl +++ b/dom/webidl/PromiseDebugging.webidl @@ -38,11 +38,7 @@ callback interface UncaughtRejectionObserver { * caught, i.e. if its `then` callback is called, `onConsumed` will * be called. */ -#ifdef SPIDERMONKEY_PROMISE void onLeftUncaught(object p); -#else - void onLeftUncaught(Promise<any> p); -#endif SPIDERMONKEY_PROMISE /** * A Promise previously left uncaught is not the last in its @@ -51,11 +47,7 @@ callback interface UncaughtRejectionObserver { * @param p A Promise that was previously left in uncaught state is * now caught, i.e. it is not the last in its chain anymore. */ -#ifdef SPIDERMONKEY_PROMISE void onConsumed(object p); -#else - void onConsumed(Promise<any> p); -#endif SPIDERMONKEY_PROMISE }; [ChromeOnly, Exposed=(Window,System)] @@ -105,42 +97,6 @@ interface PromiseDebugging { [Throws] static object? getFullfillmentStack(object p); -#ifndef SPIDERMONKEY_PROMISE - /** - * Get the promises directly depending on a given promise. These are: - * - * 1) Return values of then() calls on the promise - * 2) Return values of Promise.all() if the given promise was passed in as one - * of the arguments. - * 3) Return values of Promise.race() if the given promise was passed in as - * one of the arguments. - * - * Once a promise is settled, it will generally notify its dependent promises - * and forget about them, so this is most useful on unsettled promises. - * - * Note that this function only returns the promises that directly depend on - * p. It does not recursively return promises that depend on promises that - * depend on p. - */ - [Throws] - static sequence<Promise<any>> getDependentPromises(object p); - - /** - * Get the number of milliseconds elapsed since the given promise was created. - */ - [Throws] - static DOMHighResTimeStamp getPromiseLifetime(object p); - - /* - * Get the number of milliseconds elapsed between the promise being created - * and being settled. Throws NS_ERROR_UNEXPECTED if the promise has not - * settled. - */ - [Throws] - static DOMHighResTimeStamp getTimeToSettle(object p); - -#endif // SPIDERMONKEY_PROMISE - /** * Watching uncaught rejections on the current thread. * diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index 0fe10eff9..172895f97 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -12,8 +12,6 @@ PREPROCESSED_WEBIDL_FILES = [ 'HTMLMediaElement.webidl', 'Navigator.webidl', 'Node.webidl', - 'Promise.webidl', - 'PromiseDebugging.webidl', 'Window.webidl', ] @@ -371,6 +369,8 @@ WEBIDL_FILES = [ 'PresentationRequest.webidl', 'ProcessingInstruction.webidl', 'ProfileTimelineMarker.webidl', + 'Promise.webidl', + 'PromiseDebugging.webidl', 'PushEvent.webidl', 'PushManager.webidl', 'PushManager.webidl', |