I have noticed that tabs.onRemoved works differently in Safari 18 comparing to other browsers and Safari 17.
- Open a tab e.g. apple.com
- Take note of the active tab id using this code:
browser.tabs.query({currentWindow: true, active: true}, (x) => console.log(x[0].id))
- Add a listener on onRemoved:
browser.tabs.onRemoved.addListener(console.log)
- on the active tab, navigate to e.g. https://developer.mozilla.org
- Take note of the active tab id again (using the same tabs.query).
Expect:
- there should be no console.log of onRemoved.
- the active tab id stays the same.
Actual:
- there is a console.log of onRemoved.
- the active tab id is changed.
Please help. If this is a bug introduced in Safari 18, it would break a lot of JS Web extensions.