Hello there!
I am working on an add-on that focuses on open tabs and ran into this issue. It seems like all the other event listeners (onCreated, onAttached, onDetached, onMoved, and onUpdated) are all working except for onRemoved.
Here’s an short summary of the problem.
browser.tabs.onRemoved.addListener(handleRemoved);
async function handleRemoved(tabId: number, removeInfo: Tabs.OnRemovedRemoveInfoType): Promise<void> {
const { windowId } = removeInfo;
const allTabs = await browser.tabs.query({});
console.log('[DEBUG] Tab length after remove', allTabs.length);
}
When I check the console.log, it is printing the length before the tab (that triggered the event) got removed.
I did a bit of searching and it seems like chrome.tabs.remove is the same way.