B2G/gecko/browser/components/sessionstore/src/SessionStore.jsm
/**
   * On purge of domain data
   * @param aData
   *        String domain data
   */
On purge of domain data
@param aData
String domain data
On purge of domain data @param aData String domain data
function ssi_onPurgeDomainData(aData) {
    function containsDomain(aEntry) {
      try {
        if (this._getURIFromString(aEntry.url).host.hasRootDomain(aData))
          return true;
      }
      catch (ex) {  }
      return aEntry.children && aEntry.children.some(containsDomain, this);
    }
    for (let ix in this._windows) {
      let closedTabs = this._windows[ix]._closedTabs;
      for (let i = closedTabs.length - 1; i >= 0; i--) {
        if (closedTabs[i].state.entries.some(containsDomain, this))
          closedTabs.splice(i, 1);
      }
    }
    for (let ix = this._closedWindows.length - 1; ix >= 0; ix--) {
      let closedTabs = this._closedWindows[ix]._closedTabs;
      let openTabs = this._closedWindows[ix].tabs;
      let openTabCount = openTabs.length;
      for (let i = closedTabs.length - 1; i >= 0; i--)
        if (closedTabs[i].state.entries.some(containsDomain, this))
          closedTabs.splice(i, 1);
      for (let j = openTabs.length - 1; j >= 0; j--) {
        if (openTabs[j].entries.some(containsDomain, this)) {
          openTabs.splice(j, 1);
          if (this._closedWindows[ix].selected > j)
            this._closedWindows[ix].selected--;
        }
      }
      if (openTabs.length == 0) {
        this._closedWindows.splice(ix, 1);
      }
      else if (openTabs.length != openTabCount) {
        let selectedTab = openTabs[this._closedWindows[ix].selected - 1];
        let activeIndex = (selectedTab.index || selectedTab.entries.length) - 1;
        if (activeIndex >= selectedTab.entries.length)
          activeIndex = selectedTab.entries.length - 1;
        this._closedWindows[ix].title = selectedTab.entries[activeIndex].title;
      }
    }
    if (this._loadState == STATE_RUNNING)
      this.saveState(true);
    this._clearRestoringWindows();
  }
function ssi_onPurgeDomainData ( aData ) { function containsDomain ( aEntry ) { try { if ( this . _getURIFromString ( aEntry . url ) . host . hasRootDomain ( aData ) ) return true ; } catch ( ex ) { } return aEntry . children && aEntry . children . some ( containsDomain , this ) ; } for ( let ix in this . _windows ) { let closedTabs = this . _windows [ ix ] . _closedTabs ; for ( let i = closedTabs . length - 1 ; i >= 0 ; i -- ) { if ( closedTabs [ i ] . state . entries . some ( containsDomain , this ) ) closedTabs . splice ( i , 1 ) ; } } for ( let ix = this . _closedWindows . length - 1 ; ix >= 0 ; ix -- ) { let closedTabs = this . _closedWindows [ ix ] . _closedTabs ; let openTabs = this . _closedWindows [ ix ] . tabs ; let openTabCount = openTabs . length ; for ( let i = closedTabs . length - 1 ; i >= 0 ; i -- ) if ( closedTabs [ i ] . state . entries . some ( containsDomain , this ) ) closedTabs . splice ( i , 1 ) ; for ( let j = openTabs . length - 1 ; j >= 0 ; j -- ) { if ( openTabs [ j ] . entries . some ( containsDomain , this ) ) { openTabs . splice ( j , 1 ) ; if ( this . _closedWindows [ ix ] . selected > j ) this . _closedWindows [ ix ] . selected -- ; } } if ( openTabs . length == 0 ) { this . _closedWindows . splice ( ix , 1 ) ; } else if ( openTabs . length != openTabCount ) { let selectedTab = openTabs [ this . _closedWindows [ ix ] . selected - 1 ] ; let activeIndex = ( selectedTab . index || selectedTab . entries . length ) - 1 ; if ( activeIndex >= selectedTab . entries . length ) activeIndex = selectedTab . entries . length - 1 ; this . _closedWindows [ ix ] . title = selectedTab . entries [ activeIndex ] . title ; } } if ( this . _loadState == STATE_RUNNING ) this . saveState ( true ) ; this . _clearRestoringWindows ( ) ; }
On purge of domain data
 @param aData
        String domain data
On purge of domain data @param aData String domain data
// does a session history entry contain a url for the given domain? /* url had no host at all */ // remove all closed tabs containing a reference to the given domain // remove all open & closed tabs containing a reference to the given // domain in closed windows // Adjust the window's title if we removed an open tab // some duplication from restoreHistory - make sure we get the correct title