Bind the history state change event after replace state

This makes qunit run correctly in phantomjs, makes special
pages work again and alll the thingggs

Change-Id: I42f48f8a21dff6120e67a0e3b27147e99f4c1b29
Merge "Bind the history state change event after replace state"