message: Limit what some closures in `MainWebUi.ts` capture
diff: @@ -505,12 +505,20 @@ export class MainWebUi extends ThemeableElementBase implements AcceptsKeybinding
  this._splitLayout.update();
  const closeTabButton = DomUtils.getShadowRoot(this).getElementById("close_tab_id_" + newId);
  - closeTabButton.addEventListener('click', (ev: MouseEvent): void => {
  - this.closeTab(tabContentElement);
  - });
  + closeTabButton.addEventListener('click', this.closeTab.bind(this, tabContentElement));
  const tabHeader = DomUtils.getShadowRoot(this).getElementById("tab_id_" + newId);
  - tabHeader.addEventListener('contextmenu', ev => {
  + tabHeader.addEventListener('contextmenu', this._handleTabHeaderContextMenu.bind(this, tabContentElement), true);
  +
  + if (isTerminal) {
  + const extensionsDiv = <HTMLDivElement> DomUtils.getShadowRoot(this).getElementById("tab_title_extensions_" + newId);
  + this._addTabTitleWidgets(extensionsDiv, <EtTerminal> tabContentElement);
  + }
  +
  + return newTab;
  + }
  +
  + private _handleTabHeaderContextMenu(tabContentElement: Element, ev: MouseEvent): void {
  ev.stopImmediatePropagation();
  ev.preventDefault();
  @@ -520,14 +528,6 @@ export class MainWebUi extends ThemeableElementBase implements AcceptsKeybinding
  }
  dispatchContextMenuRequest(this, ev.clientX, ev.clientY, ContextMenuType.TERMINAL_TAB, override);
  - }, true);
  -
  - if (isTerminal) {
  - const extensionsDiv = <HTMLDivElement> DomUtils.getShadowRoot(this).getElementById("tab_title_extensions_" + newId);
  - this._addTabTitleWidgets(extensionsDiv, <EtTerminal> tabContentElement);
  - }
  -
  - return newTab;
  }
  private _addTabTitleWidgets(extensionsDiv: HTMLDivElement, terminal: EtTerminal): void {
  