And looking into this a bit more, the reason we're hitting this condition only with a browser restart seems to be because of this condition in Session Restore [`restoreWindow`](https://searchfox.org/mozilla-central/source/browser/components/sessionstore/SessionStore.sys.mjs#4862-4867) where when `overwriteTabs` is truthy - as it is in this specific restart scenerio ` selectedTab` is assigned a value greater than 0 which is then later passed to `tabbrowser.createTabsForSessionRestore`. There were probably history reasons for this, but it ends up forcing a different action for pinning tabs in the tabbrowser code which we'll probably want to address in a more cohesive way in bug 1910097.
Bug 1916188 Comment 6 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
And looking into this a bit more, the reason we're hitting this condition only with a browser restart seems to be because of this condition in Session Restore [`restoreWindow`](https://searchfox.org/mozilla-central/source/browser/components/sessionstore/SessionStore.sys.mjs#4862-4867) where when `overwriteTabs` is truthy - as it is in this specific restart scenerio ` selectedTab` is assigned a value greater than 0 which is then later passed to `tabbrowser.createTabsForSessionRestore`. There were probably historical reasons for doing this, but it ends up forcing a different action for pinning tabs in the tabbrowser code which we'll probably want to address in a more cohesive way in bug 1910097. For now I've added a condition for vertical tabs.