No-reload file permalink | phase 2 | pop state handler
This is the second issue (of at least 3) to improve the no-reload file permalink feature.
In this phase, we should implement a popstate
listener to allow reversing various actions that are taken when switching to the permalink. The listener should be bound only when the permalink is activated to reduce how often and how many listeners are bound. Initially, the most obvious reverting behavior will be to remove the SHA from the window title. There will very likely be other things that need to be reverted when toggling the permalink off (which at the moment is only possible by using the browser back button).
Additionally, we should probably add some small guards that don't continue to push entries into the history if the permalink is already active, since the back button will just step through redundant permalink entries.
For more context, please see the first phase issue.