diff --git a/web/pdf_history.js b/web/pdf_history.js index 0edc0933f..7b5e11513 100644 --- a/web/pdf_history.js +++ b/web/pdf_history.js @@ -109,7 +109,7 @@ class PDFHistory { this._currentHash = getCurrentHash(); this._numPositionUpdates = 0; - this._uid = 0; + this._uid = this._maxUid = 0; this._destination = null; this._position = null; @@ -245,7 +245,7 @@ class PDFHistory { return; } let state = window.history.state; - if (this._isValidState(state) && state.uid < (this._uid - 1)) { + if (this._isValidState(state) && state.uid < this._maxUid) { window.history.forward(); } } @@ -286,6 +286,8 @@ class PDFHistory { window.history.replaceState(newState, '', document.URL); } } else { + this._maxUid = this._uid; + if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) { // Providing the third argument causes a SecurityError for file:// URLs.