(Yet another) browsing history bug

This PR fixes a bug in the browsing history, that prevents the user from going back in the history. When this happens, the history gets "stuck" in the current state, effectively breaking the navigation.
This bug can happen when multiple pages are visible simultaneously in the viewer, i.e. at lower zoom levels and/or when the destination is on the last page of a document.

This is the first bug I've found that really causes the browser history to break, so I think that it might be a good idea to include this fix in the pending uplift to mozcentral, [bug 878897](https://bugzilla.mozilla.org/show_bug.cgi?id=878897).

/cc @brendandahl