B2G/gecko/browser/components/sessionstore/src/SessionStore.jsm
/**
   * When a tab closes, collect its properties
   * @param aWindow
   *        Window reference
   * @param aTab
   *        Tab reference
   */
When a tab closes, collect its properties
@param aWindow
Window reference
@param aTab
Tab reference
When a tab closes collect its properties @param aWindow Window reference @param aTab Tab reference
function ssi_onTabClose(aWindow, aTab) {
    var event = aWindow.document.createEvent("Events");
    event.initEvent("SSTabClosing", true, false);
    aTab.dispatchEvent(event);
    if (this._max_tabs_undo == 0) {
      return;
    }
    var tabState = this._collectTabData(aTab);
    this._updateTextAndScrollDataForTab(aWindow, aTab.linkedBrowser, tabState);
    if (this._shouldSaveTabState(tabState)) {
      let tabTitle = aTab.label;
      let tabbrowser = aWindow.gBrowser;
      tabTitle = this._replaceLoadingTitle(tabTitle, tabbrowser, aTab);
      this._windows[aWindow.__SSi]._closedTabs.unshift({
        state: tabState,
        title: tabTitle,
        image: aTab.getAttribute("image"),
        pos: aTab._tPos
      });
      var length = this._windows[aWindow.__SSi]._closedTabs.length;
      if (length > this._max_tabs_undo)
        this._windows[aWindow.__SSi]._closedTabs.splice(this._max_tabs_undo, length - this._max_tabs_undo);
    }
  }
function ssi_onTabClose ( aWindow , aTab ) { var event = aWindow . document . createEvent ( "Events" ) ; event . initEvent ( "SSTabClosing" , true , false ) ; aTab . dispatchEvent ( event ) ; if ( this . _max_tabs_undo == 0 ) { return ; } var tabState = this . _collectTabData ( aTab ) ; this . _updateTextAndScrollDataForTab ( aWindow , aTab . linkedBrowser , tabState ) ; if ( this . _shouldSaveTabState ( tabState ) ) { let tabTitle = aTab . label ; let tabbrowser = aWindow . gBrowser ; tabTitle = this . _replaceLoadingTitle ( tabTitle , tabbrowser , aTab ) ; this . _windows [ aWindow . __SSi ] . _closedTabs . unshift ( { state : tabState , title : tabTitle , image : aTab . getAttribute ( "image" ) , pos : aTab . _tPos } ) ; var length = this . _windows [ aWindow . __SSi ] . _closedTabs . length ; if ( length > this . _max_tabs_undo ) this . _windows [ aWindow . __SSi ] . _closedTabs . splice ( this . _max_tabs_undo , length - this . _max_tabs_undo ) ; } }
When a tab closes, collect its properties
 @param aWindow
        Window reference
 @param aTab
        Tab reference
When a tab closes collect its properties @param aWindow Window reference @param aTab Tab reference
// notify the tabbrowser that the tab state will be retrieved for the last time // (so that extension authors can easily set data on soon-to-be-closed tabs) // don't update our internal state if we don't have to // make sure that the tab related data is up-to-date // store closed-tab data for undo