fune/dom/chrome-webidl/PromiseDebugging.webidl
Kris Maglione 887b300cf4 Bug 1442931: Part 2 - Move internal WebIDL interfaces to separate directory. r=mystor
This change moves several chrome-only WebIDL files to a separate chrome-only
directory.

There are several other chrome-only interfaces which are heavily tied to DOM
code. Since those should probably still require DOM peer review for changes, I
left them where they were.

MozReview-Commit-ID: K3NsNtfntV6

--HG--
rename : dom/webidl/ChannelWrapper.webidl => dom/chrome-webidl/ChannelWrapper.webidl
rename : dom/webidl/ChromeUtils.webidl => dom/chrome-webidl/ChromeUtils.webidl
rename : dom/webidl/DominatorTree.webidl => dom/chrome-webidl/DominatorTree.webidl
rename : dom/webidl/HeapSnapshot.webidl => dom/chrome-webidl/HeapSnapshot.webidl
rename : dom/webidl/InspectorUtils.webidl => dom/chrome-webidl/InspectorUtils.webidl
rename : dom/webidl/MatchGlob.webidl => dom/chrome-webidl/MatchGlob.webidl
rename : dom/webidl/MatchPattern.webidl => dom/chrome-webidl/MatchPattern.webidl
rename : dom/webidl/MozStorageAsyncStatementParams.webidl => dom/chrome-webidl/MozStorageAsyncStatementParams.webidl
rename : dom/webidl/MozStorageStatementParams.webidl => dom/chrome-webidl/MozStorageStatementParams.webidl
rename : dom/webidl/MozStorageStatementRow.webidl => dom/chrome-webidl/MozStorageStatementRow.webidl
rename : dom/webidl/PrecompiledScript.webidl => dom/chrome-webidl/PrecompiledScript.webidl
rename : dom/webidl/PromiseDebugging.webidl => dom/chrome-webidl/PromiseDebugging.webidl
rename : dom/webidl/StructuredCloneHolder.webidl => dom/chrome-webidl/StructuredCloneHolder.webidl
rename : dom/webidl/WebExtensionContentScript.webidl => dom/chrome-webidl/WebExtensionContentScript.webidl
rename : dom/webidl/WebExtensionPolicy.webidl => dom/chrome-webidl/WebExtensionPolicy.webidl
rename : dom/webidl/moz.build => dom/chrome-webidl/moz.build
extra : rebase_source : e1ea7dad6450a10e5f48e622814efe28e0c13977
extra : intermediate-source : 9f46e7d52b9b2e30bf0ccf64bb5805168dd79c29
extra : source : 195cbf3d34334978e5a9d101d4b79f899598159c
2018-03-04 16:37:10 -08:00

108 lines
3.6 KiB
Text

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 http://mozilla.org/MPL/2.0/.
*/
/* This is a utility namespace for promise-debugging functionality */
dictionary PromiseDebuggingStateHolder {
PromiseDebuggingState state = "pending";
any value;
any reason;
};
enum PromiseDebuggingState { "pending", "fulfilled", "rejected" };
/**
* An observer for Promise that _may_ be leaking uncaught rejections.
*
* It is generally a programming error to leave a Promise rejected and
* not consume its rejection. The information exposed by this
* interface is designed to allow clients to track down such Promise,
* i.e. Promise that are currently
* - in `rejected` state;
* - last of their chain.
*
* Note, however, that a promise in such a state at the end of a tick
* may eventually be consumed in some ulterior tick. Implementers of
* this interface are responsible for presenting the information
* in a meaningful manner.
*/
callback interface UncaughtRejectionObserver {
/**
* A Promise has been left in `rejected` state and is the
* last in its chain.
*
* @param p A currently uncaught Promise. If `p` is is eventually
* caught, i.e. if its `then` callback is called, `onConsumed` will
* be called.
*/
void onLeftUncaught(object p);
/**
* A Promise previously left uncaught is not the last in its
* chain anymore.
*
* @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.
*/
void onConsumed(object p);
};
[ChromeOnly, Exposed=(Window,System)]
interface PromiseDebugging {
/**
* The various functions on this interface all expect to take promises but
* don't want the WebIDL behavior of assimilating random passed-in objects
* into promises. They also want to treat Promise subclass instances as
* promises instead of wrapping them in a vanilla Promise, which is what the
* IDL spec says to do. So we list all our arguments as "object" instead of
* "Promise" and check for them being a Promise internally.
*/
/**
* Get the current state of the given promise.
*/
[Throws]
static PromiseDebuggingStateHolder getState(object p);
/**
* Return an identifier for a promise. This identifier is guaranteed
* to be unique to the current process.
*/
[Throws]
static DOMString getPromiseID(object p);
/**
* Return the stack to the promise's allocation point. This can
* return null if the promise was not created from script.
*/
[Throws]
static object? getAllocationStack(object p);
/**
* Return the stack to the promise's rejection point, if the
* rejection happened from script. This can return null if the
* promise has not been rejected or was not rejected from script.
*/
[Throws]
static object? getRejectionStack(object p);
/**
* Return the stack to the promise's fulfillment point, if the
* fulfillment happened from script. This can return null if the
* promise has not been fulfilled or was not fulfilled from script.
*/
[Throws]
static object? getFullfillmentStack(object p);
/**
* Watching uncaught rejections on the current thread.
*
* Adding an observer twice will cause it to be notified twice
* of events.
*/
static void addUncaughtRejectionObserver(UncaughtRejectionObserver o);
static boolean removeUncaughtRejectionObserver(UncaughtRejectionObserver o);
};