Im using several strategies now:
Using a “tabs.onRemoved” handler plus a “windows.onRemoved” handler.
The code is located here:
What it basically does, a timeout on “onCreated” (tab + windows) triggers a timeout - which reads out urls of the tabs after 5 seconds, so Firefox has a chance to provide the correct url instead of “about:blank”.
The tab is stored with this information:
[window.id][tab.id] = {“s”: cookieStoreId, “u”: url, “d”: domainName}
This does work, when checking the debug log of the add-on at window close / tab remove event - if thats a secondary window.
But on the main window, this fails.
I checked by:
- Logging into a website/service
- Using “global” to flag and remove all cookies on page action (reload, load and such)
- Opening a new tab (about:blank)
- Closing the window
What should happen, the action to clean the cookies should apply on window close/tab removal as for other windows.
After reopening Firefox, the about:blank tab is shown:
- Deactivate “global” (it will trigger on page load after init of Firefox)
- Switch to the particular tab
- Refresh the page
- Still logged in, even so cookies should have been removed.
As mentioned, on subwindows (every other then the last) this does seem to work. According to the logs and what I tested.
On the main window, which becomes closed, it doens’t apply.