Bug 1905470 - Update android nightly application-services version bump to 7fae3fe1457...
[gecko.git] / toolkit / modules / docs / FirstStartup.rst
blob426c341dafb4b58b0bd9ad1ea1c89670b41b33dc
1 .. _FirstStartup:
3 ==============
4 FirstStartup
5 ==============
7 ``FirstStartup`` is a module which is invoked on application startup by the Windows Installer,
8 to initialize services before the first application window appears.
10 This is useful for:
12 - one-time performance tuning
13 - downloading critical data (hotfixes, experiments, etc)
15 Blocking until the first Application window appears is important because the Installer
16 will show a progress bar until this happens. This gives a user experience of:
18 1. User downloads and starts the Windows Stub Installer.
19 2. Progress bar advances while the application is downloaded and installed.
20 3. Installer invokes the application with ``--first-startup``.
21 4. Application window appears, and the installer window closes.
23 Overall, the user experiences a very fast first-startup, with critical tasks that normally
24 would be deferred until after UI startup already complete.
26 .. _FirstStartup Architecture:
28 FirstStartup: Example use case
29 ==============================
31 An example use of the ``FirstStartup`` module is to invoke the Normandy client to download an experiment
32 that will be used to customize the first-run page that Firefox shows.
34 In this example, the first-run page would be loaded experimentally based on an attribution code provided
35 by the Installer. The flow for this looks like:
37 1. User clicks on download link containing an attribution (UTM) code(s).
38 2. The download page serves a custom Windows Stub Installer with the appropriate attribution code embedded.
39 3. The installer invokes Firefox with the `--first-startup` flag, which blocks the first window.
40 4. Normandy is run by ``FirstStartup`` and downloads a list of available experiments, or "recipes".
41 5. Recipes are evaluated and filtered based on local information, such as the OS platform and the attribution codes.
42 6. A recipe is found which matches the current attribution code, and appropriate data is made available to the first-run page.
43 7. ``FirstStartup`` completes and unblocks, which causes Firefox to show the first window and load the appropriate first-run data.
45 List of phases
46 ==============
48 ``FirstStartup.NOT_STARTED``
50   The ``FirstStartup`` module has not been initialized (the ``init()``
51   function has not been called). This is the default state.
53 ``FirstStartup.IN_PROGRESS``
55   ``FirstStartup.init()`` has been called, and the event loop is
56   spinning. This state will persist until either all startup tasks
57   have finished, or time-out has been reached.
59   The time-out defaults to 30 seconds, but is configurable via the
60   ``first-startup.timeout`` pref, which is specified in milliseconds.
62 ``FirstStartup.TIMED_OUT``
64   The time-out has been reached before startup tasks are complete.
66 ``FirstStartup.SUCCESS``
68   All startup tasks have completed successfully, and application startup may resume.
70 ``FirstStartup.UNSUPPORTED``
72   No startup tasks are supported, and `FirstStartup` exited.