code: function tabBrowser_openInNewTab(aEvent) {
      var event = aEvent || { };
      var type = (event.type == undefined) ? "middleClick" : event.type;
  
      // Disable tab closing animation for default behavior
      prefs.preferences.setPref(PREF_TABS_ANIMATE, false);
  
      // Add event listener to wait until the tab has been opened
      var self = { opened: false };
      function checkTabOpened() { self.opened = true; }
      this._controller.window.addEventListener("TabOpen", checkTabOpened, false);
  
      switch (type) {
        case "contextMenu":
          var contextMenuItem = new elementslib.ID(this._controller.window.document,
                                                   "context-openlinkintab");
          this._controller.rightClick(event.target);
          this._controller.click(contextMenuItem);
          utils.closeContentAreaContextMenu(this._controller);
          break;
        case "middleClick":
          this._controller.middleClick(event.target);
          break;
        default:
          throw new Error(arguments.callee.name + ": Unknown event type - " + type);
      }
  
      try {
        this._controller.waitForEval("subject.tab.opened == true", TIMEOUT, 100,
                                     {tab: self});
      } finally {
        this._controller.window.removeEventListener("TabOpen", checkTabOpened, false);
        prefs.preferences.clearUserPref(PREF_TABS_ANIMATE);
      }
    }
docs: Open element (link) in a new tab
  
  @param {object} aEvent
  The event specifies how to open the element in a new tab
  Elements: type - Type of event (contextMenu, middleClick)
  [optional - default: middleClick]