Firefox addon that adds a keyboard shortcut to switch back to your most recently selected tab. Useful to alternate between two tabs and to easily go back to your last tab if you switch to another briefly.
Currently the history is stored in addon's memory, and reset every time Firefox is relaunched. With the sessions API, this data could be stored against the window or tabs directly and preserved across sessions.
Steps to Reproduce
Do some browsing
Close Firefox
Restart Firefox
Use the shortcut
Expected behavior: [What you expected to happen]
The most recent tab from the last session is opened
Actual behavior: [What actually happens]
Nothing
Other Information and Versions
Approach 1: Save a queue to the Window
Instead of having a Map from windowID -> queue, store a queue directly on the window session.
Pros - Very similar to how the addon works already, easy to migrate to.
Notes - Objects saved to the session are stringified, so we'd likely be serializing JSON. This could be slow with lots of tabs. We could cap the history length to mitigate this.
Approach 2: Save something on each tab
Instead of having a queue, store a reference to the previous tab, or a sequence number, on each tab.
Pros - No more maintaining a separate structure of tabs, pushing things down to the tabs themselves.
Cons - Different approach, would require more rework. Sequence number approach would require O(number of tabs in window) operations. Reference to previous tab would be quick but need a bit more bookkeeping.
Description
Currently the history is stored in addon's memory, and reset every time Firefox is relaunched. With the sessions API, this data could be stored against the window or tabs directly and preserved across sessions.
Steps to Reproduce
Expected behavior: [What you expected to happen]
Actual behavior: [What actually happens]
Other Information and Versions
Approach 1: Save a queue to the Window
Instead of having a Map from windowID -> queue, store a queue directly on the window session.
Pros - Very similar to how the addon works already, easy to migrate to. Notes - Objects saved to the session are stringified, so we'd likely be serializing JSON. This could be slow with lots of tabs. We could cap the history length to mitigate this.
Approach 2: Save something on each tab
Instead of having a queue, store a reference to the previous tab, or a sequence number, on each tab.
Pros - No more maintaining a separate structure of tabs, pushing things down to the tabs themselves. Cons - Different approach, would require more rework. Sequence number approach would require O(number of tabs in window) operations. Reference to previous tab would be quick but need a bit more bookkeeping.