B2G/gecko/browser/components/sessionstore/src/SessionStore.jsm
/**
   * Implement nsIDOMEventListener for handling various window and tab events
   */
Implement nsIDOMEventListener for handling various window and tab events
Implement nsIDOMEventListener for handling various window and tab events
function ssi_handleEvent(aEvent) {
    var win = aEvent.currentTarget.ownerDocument.defaultView;
    switch (aEvent.type) {
      case "load":
        if (aEvent.currentTarget.__SS_restore_data)
          this.restoreDocument(win, aEvent.currentTarget, aEvent);
      case "pageshow":
        this.onTabLoad(win, aEvent.currentTarget, aEvent);
        break;
      case "change":
      case "input":
      case "DOMAutoComplete":
        this.onTabInput(win, aEvent.currentTarget);
        break;
      case "TabOpen":
        this.onTabAdd(win, aEvent.originalTarget);
        break;
      case "TabClose":
        if (!aEvent.detail)
          this.onTabClose(win, aEvent.originalTarget);
        this.onTabRemove(win, aEvent.originalTarget);
        break;
      case "TabSelect":
        this.onTabSelect(win);
        break;
      case "TabShow":
        this.onTabShow(win, aEvent.originalTarget);
        break;
      case "TabHide":
        this.onTabHide(win, aEvent.originalTarget);
        break;
      case "TabPinned":
      case "TabUnpinned":
        this.saveStateDelayed(win);
        break;
    }
    this._clearRestoringWindows();
  }
function ssi_handleEvent ( aEvent ) { var win = aEvent . currentTarget . ownerDocument . defaultView ; switch ( aEvent . type ) { case "load" : if ( aEvent . currentTarget . __SS_restore_data ) this . restoreDocument ( win , aEvent . currentTarget , aEvent ) ; case "pageshow" : this . onTabLoad ( win , aEvent . currentTarget , aEvent ) ; break ; case "change" : case "input" : case "DOMAutoComplete" : this . onTabInput ( win , aEvent . currentTarget ) ; break ; case "TabOpen" : this . onTabAdd ( win , aEvent . originalTarget ) ; break ; case "TabClose" : if ( ! aEvent . detail ) this . onTabClose ( win , aEvent . originalTarget ) ; this . onTabRemove ( win , aEvent . originalTarget ) ; break ; case "TabSelect" : this . onTabSelect ( win ) ; break ; case "TabShow" : this . onTabShow ( win , aEvent . originalTarget ) ; break ; case "TabHide" : this . onTabHide ( win , aEvent . originalTarget ) ; break ; case "TabPinned" : case "TabUnpinned" : this . saveStateDelayed ( win ) ; break ; } this . _clearRestoringWindows ( ) ; }
Implement nsIDOMEventListener for handling various window and tab events
Implement nsIDOMEventListener for handling various window and tab events
// If __SS_restore_data is set, then we need to restore the document // (form data, scrolling, etc.). This will only happen when a tab is // first restored. // We still need to call onTabLoad, so fall through to "pageshow" case. // aEvent.detail determines if the tab was closed by moving to a different window