Background Updates

From MozillaWiki
Jump to navigation Jump to search

This page describes the technical plan to move the process of applying the updates in Firefox to the background as opposed to at startup. In order to get a clear idea about the scope of the project, please see the Goals and Non-Goals sections below.

Goals

  1. Moving the update process to the background
  2. Initiating the update process as soon as an update is downloaded
  3. Being able to apply a newer update if Firefox was not restarted since the previous update was applied in the background
  4. Try to do as little as possible at startup
  5. Eliminate the progress bar UI that the current updater shows

Non-Goals

  1. Handling UAC prompts on Windows
  2. Changing the frequency of checking for updates, our handling of major/minor updates, or the way we check for add-ons compatibility
  3. Eliminating the UI we display in Step 2
  4. Changing how updates work on Android
  5. Any of the other projects falling under the "silent update" umbrella

Implementation

Here is a proposal for how background updates will be implemented.

  • The process will start by Firefox checking for an update in the background (as it does today).
  • Once an update is found
    • If the user needs to prompted for some reason, we show that prompt. If the user declines, we bail out.
    • Otherwise, we go ahead and download the update (as a complete/partial MAR file) in the background.
  • Once the download is finished, Firefox launches the updater binary in the background with the UI display disabled. Searching for new updates will be paused during this time.
    • The target of the update will be known FIREFOX_NEW from now on.
      • On Windows, if Firefox is installed to "C:\path\to\Mozilla Firefox", FIREFOX_NEW will be "C:\path\to\Mozilla Firefox.new".
      • On Mac, if Firefox is installed to "/path/to/Firefox.app", FIREFOX_NEW will be "/path/to/Firefox.app/Updated.app". In other words, the updated version of Firefox will be installed as a bundle inside the existing Firefox bundle.
      • On Linux, if Firefox is installed to a flat directory like "/path/to/firefox", FIREFOX_NEW will be "/path/to/firefox.new". If it's installed in a non-flat directory structure (like /usr/bin for example), the details of where FIREFOX_NEW will be is TBD.
    • The manifest file will be known as a file named "update.pending" located in the root of the existing Firefox installation.
  • The updater binary checks to see if there is an existing manifest file.
    • If this file exists, it will be removed.
  • The updater binary checks to see if there is an existing FIREFOX_NEW directory.
    • If this directory exists, it will be removed.
  • The updater binary will go ahead and apply the update to the FIREFOX_NEW directory using the existing installation directory as the base.
  • The updater binary will write a new manifest file to the existing installation directory.
  • The updater binary will shutdown, and signal the Firefox main process.
  • The Firefox main process will resume searching for new updates.