Skip to content

Commit

Permalink
Fix updating context menu
Browse files Browse the repository at this point in the history
Check if the active controller exists.
  • Loading branch information
alexesprit committed Jun 24, 2020
1 parent 889b949 commit 7059b57
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/core/background/object/tab-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ define((require) => {
this.resetContextMenu();

const ctrl = this.tabControllers[tabId];
const activeCtrl = this.tabControllers[this.activeTabId];

// Always display context menu for current tab
if (ctrl) {
Expand All @@ -301,12 +300,16 @@ define((require) => {

// Add additional menu items for active tab (if it's not current)...
if (this.activeTabId !== tabId) {
if (ctrl && activeCtrl && activeCtrl.getConnector().id === ctrl.getConnector().id) {
return;
}
const activeCtrl = this.tabControllers[this.activeTabId];

// ...but only if it has a different connector injected.
this.addToggleConnectorMenu(tabId, activeCtrl);
if (activeCtrl) {
if (ctrl && activeCtrl.getConnector().id === ctrl.getConnector().id) {
return;
}

// ...but only if it has a different connector injected.
this.addToggleConnectorMenu(tabId, activeCtrl);
}
}
}

Expand Down

0 comments on commit 7059b57

Please sign in to comment.