Name Description Size
AsyncShutdown.sys.mjs Managing safe shutdown of asynchronous services. Firefox shutdown is composed of phases that take place sequentially. Typically, each shutdown phase removes some capabilities from the application. For instance, at the end of phase profileBeforeChange, no service is permitted to write to the profile directory (with the exception of Telemetry). Consequently, if any service has requested I/O to the profile directory before or during phase profileBeforeChange, the system must be informed that these requests need to be completed before the end of phase profileBeforeChange. Failing to inform the system of this requirement can (and has been known to) cause data loss. Example: At some point during shutdown, the Add-On Manager needs to ensure that all add-ons have safely written their data to disk, before writing its own data. Since the data is saved to the profile, this must be completed during phase profileBeforeChange. AsyncShutdown.profileBeforeChange.addBlocker( "Add-on manager: shutting down", function condition() { // Do things. // Perform I/O that must take place during phase profile-before-change return promise; } }); In this example, function |condition| will be called at some point during phase profileBeforeChange and phase profileBeforeChange itself is guaranteed to not terminate until |promise| is either resolved or rejected. 36196
components.conf 592
moz.build 640
nsAsyncShutdown.sys.mjs An implementation of nsIAsyncShutdown* based on AsyncShutdown.sys.mjs 6989
nsIAsyncShutdown.idl A mechanism for specifying shutdown dependencies between asynchronous services. Note that this XPCOM component is designed primarily for C++ clients. JavaScript clients should rather use AsyncShutdown.sys.mjs, which provides a better API and better error reporting for them. 6753
tests