As its name implies the pop state event only fires when an event is popped from the history, not when an entry is pushed into the history.
In your example if you have two history entries, the initial entry that happens when the page loads from the server, and a second which is the one you have just pushed.
When you press the browsers back button the state that you are getting in the event is the original entry, from when the page loaded. The popstate event gives you the state that you are currently on, not the state that was just popped from the stack. Slightly confusing.
In your example if you pushed two entries into the stack, both with state data, and then hit the back button, your event handler should show you the state data of the first state you pushed into the history stack.