B2G/gecko/browser/components/sessionstore/src/SessionStore.jsm
/**
   * On preference change
   * @param aData
   *        String preference changed
   */
On preference change
@param aData
String preference changed
On preference change @param aData String preference changed
function ssi_onPrefChange(aData) {
    switch (aData) {
      case "sessionstore.max_tabs_undo":
        this._max_tabs_undo = this._prefBranch.getIntPref("sessionstore.max_tabs_undo");
        for (let ix in this._windows) {
          this._windows[ix]._closedTabs.splice(this._max_tabs_undo, this._windows[ix]._closedTabs.length);
        }
        break;
      case "sessionstore.max_windows_undo":
        this._max_windows_undo = this._prefBranch.getIntPref("sessionstore.max_windows_undo");
        this._capClosedWindows();
        break;
      case "sessionstore.interval":
        this._interval = this._prefBranch.getIntPref("sessionstore.interval");
        if (this._saveTimer) {
          this._saveTimer.cancel();
          this._saveTimer = null;
        }
        this.saveStateDelayed(null, -1);
        break;
      case "sessionstore.resume_from_crash":
        this._resume_from_crash = this._prefBranch.getBoolPref("sessionstore.resume_from_crash");
        if (this._resume_session_once_on_shutdown != null) {
          this._prefBranch.setBoolPref("sessionstore.resume_session_once",
                                       this._resume_session_once_on_shutdown);
          this._resume_session_once_on_shutdown = null;
        }
        if (!this._resume_from_crash)
          this._clearDisk();
        this.saveState(true);
        break;
      case "sessionstore.restore_on_demand":
        this._restoreOnDemand =
          this._prefBranch.getBoolPref("sessionstore.restore_on_demand");
        break;
      case "sessionstore.restore_hidden_tabs":
        this._restoreHiddenTabs =
          this._prefBranch.getBoolPref("sessionstore.restore_hidden_tabs");
        break;
      case "sessionstore.restore_pinned_tabs_on_demand":
        this._restorePinnedTabsOnDemand =
          this._prefBranch.getBoolPref("sessionstore.restore_pinned_tabs_on_demand");
        break;
    }
  }
function ssi_onPrefChange ( aData ) { switch ( aData ) { case "sessionstore.max_tabs_undo" : this . _max_tabs_undo = this . _prefBranch . getIntPref ( "sessionstore.max_tabs_undo" ) ; for ( let ix in this . _windows ) { this . _windows [ ix ] . _closedTabs . splice ( this . _max_tabs_undo , this . _windows [ ix ] . _closedTabs . length ) ; } break ; case "sessionstore.max_windows_undo" : this . _max_windows_undo = this . _prefBranch . getIntPref ( "sessionstore.max_windows_undo" ) ; this . _capClosedWindows ( ) ; break ; case "sessionstore.interval" : this . _interval = this . _prefBranch . getIntPref ( "sessionstore.interval" ) ; if ( this . _saveTimer ) { this . _saveTimer . cancel ( ) ; this . _saveTimer = null ; } this . saveStateDelayed ( null , - 1 ) ; break ; case "sessionstore.resume_from_crash" : this . _resume_from_crash = this . _prefBranch . getBoolPref ( "sessionstore.resume_from_crash" ) ; if ( this . _resume_session_once_on_shutdown != null ) { this . _prefBranch . setBoolPref ( "sessionstore.resume_session_once" , this . _resume_session_once_on_shutdown ) ; this . _resume_session_once_on_shutdown = null ; } if ( ! this . _resume_from_crash ) this . _clearDisk ( ) ; this . saveState ( true ) ; break ; case "sessionstore.restore_on_demand" : this . _restoreOnDemand = this . _prefBranch . getBoolPref ( "sessionstore.restore_on_demand" ) ; break ; case "sessionstore.restore_hidden_tabs" : this . _restoreHiddenTabs = this . _prefBranch . getBoolPref ( "sessionstore.restore_hidden_tabs" ) ; break ; case "sessionstore.restore_pinned_tabs_on_demand" : this . _restorePinnedTabsOnDemand = this . _prefBranch . getBoolPref ( "sessionstore.restore_pinned_tabs_on_demand" ) ; break ; } }
On preference change
 @param aData
        String preference changed
On preference change @param aData String preference changed
// if the user decreases the max number of closed tabs they want // preserved update our internal states to match that max // reset timer and save // restore original resume_session_once preference if set in saveState // either create the file with crash recovery information or remove it // (when _loadState is not STATE_RUNNING, that file is used for session resuming instead)