@ItsMika thanks for your answer. I wonder if this solution still works on an MV3 web extension as a background script is no longer there.
Post
Replies
Boosts
Views
Activity
I am aware of the post regarding tabs.onReplaced. However, that does not address my issue.
Unlike, tabs.onReplaced, the Safari-18-specific tabs.onRemoved behaviour cannot occur in Chrome or any browsers under any conditions. It's clear that tabs.onRemoved shall be fired when a tab is closed. According to my scenario, no tab was closed. I disagree that this is an expected behaviour. Please help.
Thank you for your reply. Good to know you've a fix for it.
When will it be available by the way? My web extension is suffered from it and currently being rejected from the Apple Review because of this bug.
I have another bug to report related to tabs.onRemoved. Safari 18 throws tabs.onRemoved incorrectly when redirect to a different scheme e.g. from https to safari-extension. Where is the best place to report this issue? Here in this forum or WebKit repo on Git?
the workaround still works in MV3. Please see my updated comment above.
UPDATED: as @papegaaij mentioned, the workaround to use webRequest.onBeforeRedirect does not work anymore in MV3. Anyway, you can use tabs.onUpdated instead. tabs.onUpdated provides changeInfo object where you can observe a url being redirected to.
browser.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
if (changeInfo.url && changeInfo.url === 'your-reachable-redirect-url') {
// do your post sign-in ceremony
// e.g. take authCode from the query param, etc.
}
})