Allow overwriting temporary, in addition to empty, history entries on 'pagehide'

When navigating away from the viewer, there's no good reason for disallowing replacement of a *temporary* history entry (in addition to empty ones).

Given that the current position is temporarily added to the browser history using a (short) timeout, the history entry will most likely already be correct when the 'pagehide' event fires. However, if the user is quick enough that might not always be the case, in which case the adjusted logic may help.
This commit is contained in:
Jonas Jenwald 2018-01-11 12:28:34 +01:00
parent 448a7a27cb
commit e20eacd484

View File

@ -547,10 +547,10 @@ class PDFHistory {
_boundEvents.pageHide = (evt) => {
// Attempt to push the `this._position` into the browser history when
// navigating away from the document. This is *only* done if the history
// is currently empty, since otherwise an existing browser history entry
// is empty/temporary, since otherwise an existing browser history entry
// will end up being overwritten (given that new entries cannot be pushed
// into the browser history when the 'unload' event has already fired).
if (!this._destination) {
if (!this._destination || this._destination.temporary) {
this._tryPushCurrentPosition();
}
};