B2G/gecko/browser/components/sessionstore/src/SessionStore.jsm
/**
   * This _attempts_ to restore the next available tab. If the restore fails,
   * then we will attempt the next one.
   * There are conditions where this won't do anything:
   *   if we're in the process of quitting
   *   if there are no tabs to restore
   *   if we have already reached the limit for number of tabs to restore
   */
This _attempts_ to restore the next available tab. If the restore fails,
then we will attempt the next one.
There are conditions where this won't do anything:
if we're in the process of quitting
if there are no tabs to restore
if we have already reached the limit for number of tabs to restore
This _attempts_ to restore the next available tab . If the restore fails then we will attempt the next one . There are conditions where this won ' t do anything : if we ' re in the process of quitting if there are no tabs to restore if we have already reached the limit for number of tabs to restore
function ssi_restoreNextTab() {
    if (this._loadState == STATE_QUITTING)
      return;
    if ((this._restoreOnDemand &&
        (this._restorePinnedTabsOnDemand || !this._tabsToRestore.priority.length)) ||
        this._tabsRestoringCount >= MAX_CONCURRENT_TAB_RESTORES)
      return;
    let nextTabArray;
    if (this._tabsToRestore.priority.length) {
      nextTabArray = this._tabsToRestore.priority
    }
    else if (this._tabsToRestore.visible.length) {
      nextTabArray = this._tabsToRestore.visible;
    }
    else if (this._restoreHiddenTabs && this._tabsToRestore.hidden.length) {
      nextTabArray = this._tabsToRestore.hidden;
    }
    if (nextTabArray) {
      let tab = nextTabArray.shift();
      let didStartLoad = this.restoreTab(tab);
      if (!didStartLoad)
        this.restoreNextTab();
    }
  }
function ssi_restoreNextTab ( ) { if ( this . _loadState == STATE_QUITTING ) return ; if ( ( this . _restoreOnDemand && ( this . _restorePinnedTabsOnDemand || ! this . _tabsToRestore . priority . length ) ) || this . _tabsRestoringCount >= MAX_CONCURRENT_TAB_RESTORES ) return ; let nextTabArray ; if ( this . _tabsToRestore . priority . length ) { nextTabArray = this . _tabsToRestore . priority } else if ( this . _tabsToRestore . visible . length ) { nextTabArray = this . _tabsToRestore . visible ; } else if ( this . _restoreHiddenTabs && this . _tabsToRestore . hidden . length ) { nextTabArray = this . _tabsToRestore . hidden ; } if ( nextTabArray ) { let tab = nextTabArray . shift ( ) ; let didStartLoad = this . restoreTab ( tab ) ; if ( ! didStartLoad ) this . restoreNextTab ( ) ; } }
This _attempts_ to restore the next available tab.
This _attempts_ to restore the next available tab .
// If we call in here while quitting, we don't actually want to do anything // If it's not possible to restore anything, then just bail out. // Look in priority, then visible, then hidden // If we don't start a load in the restored tab (eg, no entries) then we // want to attempt to restore the next tab.