Post

Replies

Boosts

Views

Activity

browser.tabs.onRemoved.addListener not functioning correctly
I'm creating a safari extension where if a tab/window is closed, I need it to do some background cleaning, for example removing the local storage data. I tried the following lines in my background.js: browser.tabs.onRemoved.addListener((tabId, removeInfo) => { console.log("tab closed"); }); browser.windows.onRemoved.addListener(function(windowid) { console.log("window closed") }) windows.onRemoved seems to work fine, but tabs.onRemoved seems to be working exactly like windows.onRemoved. I've tested it multiple times and every time without any hesitation, I don't get any "tab closed" in my console logs. But when I close the window, I get both messages above. Is this a bug? Is there something I'm missing? I'm using Safari v16.3
3
0
1.1k
Apr ’23