FirstStartup is a module which is invoked on application startup by the Windows Installer,
to initialize services before the first application window appears.
This is useful for:
one-time performance tuning
downloading critical data (hotfixes, experiments, etc)
Blocking until the first Application window appears is important because the Installer will show a progress bar until this happens. This gives a user experience of:
User downloads and starts the Windows Stub Installer.
Progress bar advances while the application is downloaded and installed.
Installer invokes the application with
Application window appears, and the installer window closes.
Overall, the user experiences a very fast first-startup, with critical tasks that normally would be deferred until after UI startup already complete.
FirstStartup: Example use case¶
An example use of the
FirstStartup module is to invoke the Normandy client to download an experiment
that will be used to customize the first-run page that Firefox shows.
In this example, the first-run page would be loaded experimentally based on an attribution code provided by the Installer. The flow for this looks like:
User clicks on download link containing an attribution (UTM) code(s).
The download page serves a custom Windows Stub Installer with the appropriate attribution code embedded.
The installer invokes Firefox with the –first-startup flag, which blocks the first window.
Normandy is run by
FirstStartupand downloads a list of available experiments, or “recipes”.
Recipes are evaluated and filtered based on local information, such as the OS platform and the attribution codes.
A recipe is found which matches the current attribution code, and appropriate data is made available to the first-run page.
FirstStartupcompletes and unblocks, which causes Firefox to show the first window and load the appropriate first-run data.
List of phases¶
FirstStartupmodule has not been initialized (the
init()function has not been called). This is the default state.
FirstStartup.init()has been called, and the event loop is spinning. This state will persist until either all startup tasks have finished, or time-out has been reached.
The time-out defaults to 30 seconds, but is configurable via the
first-startup.timeoutpref, which is specified in milliseconds.
The time-out has been reached before startup tasks are complete.
All startup tasks have completed successfully, and application startup may resume.
No startup tasks are supported, and FirstStartup exited.