B2G/gecko/browser/components/sessionstore/src/SessionStore.jsm
/**
   * @param aState is a session state
   * @param aRecentCrashes is the number of consecutive crashes
   * @returns whether a restore page will be needed for the session state
   */
@param aState is a session state
@param aRecentCrashes is the number of consecutive crashes
@returns whether a restore page will be needed for the session state
@param aState is a session state @param aRecentCrashes is the number of consecutive crashes @returns whether a restore page will be needed for the session state
function ssi_needsRestorePage(aState, aRecentCrashes) {
    const SIX_HOURS_IN_MS = 6 * 60 * 60 * 1000;
    let winData = aState.windows || null;
    if (!winData || winData.length == 0)
      return false;
    if (winData.length == 1 && winData[0].tabs &&
        winData[0].tabs.length == 1 && winData[0].tabs[0].entries &&
        winData[0].tabs[0].entries.length == 1 &&
        winData[0].tabs[0].entries[0].url == "about:sessionrestore")
      return false;
    if (Services.appinfo.inSafeMode)
      return true;
    let max_resumed_crashes =
      this._prefBranch.getIntPref("sessionstore.max_resumed_crashes");
    let sessionAge = aState.session && aState.session.lastUpdate &&
                     (Date.now() - aState.session.lastUpdate);
    return max_resumed_crashes != -1 &&
           (aRecentCrashes > max_resumed_crashes ||
            sessionAge && sessionAge >= SIX_HOURS_IN_MS);
  }
function ssi_needsRestorePage ( aState , aRecentCrashes ) { const SIX_HOURS_IN_MS = 6 * 60 * 60 * 1000 ; let winData = aState . windows || null ; if ( ! winData || winData . length == 0 ) return false ; if ( winData . length == 1 && winData [ 0 ] . tabs && winData [ 0 ] . tabs . length == 1 && winData [ 0 ] . tabs [ 0 ] . entries && winData [ 0 ] . tabs [ 0 ] . entries . length == 1 && winData [ 0 ] . tabs [ 0 ] . entries [ 0 ] . url == "about:sessionrestore" ) return false ; if ( Services . appinfo . inSafeMode ) return true ; let max_resumed_crashes = this . _prefBranch . getIntPref ( "sessionstore.max_resumed_crashes" ) ; let sessionAge = aState . session && aState . session . lastUpdate && ( Date . now ( ) - aState . session . lastUpdate ) ; return max_resumed_crashes != - 1 && ( aRecentCrashes > max_resumed_crashes || sessionAge && sessionAge >= SIX_HOURS_IN_MS ) ; }
@param aState is a session state
 @param aRecentCrashes is the number of consecutive crashes
 @returns whether a restore page will be needed for the session state
@param aState is a session state @param aRecentCrashes is the number of consecutive crashes @returns whether a restore page will be needed for the session state
// don't display the page when there's nothing to restore // don't wrap a single about:sessionrestore page // don't automatically restore in Safe Mode