From b302fd3a6ece8559105c3e1d608872a274db2cf7 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Mon, 12 Oct 2020 12:26:19 +0200 Subject: [PATCH] Move updating of `this._maxUid` into `PDFHistory._updateInternalState` There's no compelling reason to update this property *manually* in multiple places, since that's error-prone with any future code changes, given that `_updateInternalState` is always called just before anyway. --- web/pdf_history.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/web/pdf_history.js b/web/pdf_history.js index 696595a5d..51e6038fd 100644 --- a/web/pdf_history.js +++ b/web/pdf_history.js @@ -143,9 +143,6 @@ class PDFHistory { state.uid, /* removeTemporary = */ true ); - if (this._uid > this._maxUid) { - this._maxUid = this._uid; - } if (destination.rotation !== undefined) { this._initialRotation = destination.rotation; @@ -410,7 +407,6 @@ class PDFHistory { if (shouldReplace) { window.history.replaceState(newState, "", newUrl); } else { - this._maxUid = this._uid; window.history.pushState(newState, "", newUrl); } @@ -534,6 +530,7 @@ class PDFHistory { } this._destination = destination; this._uid = uid; + this._maxUid = Math.max(this._maxUid, uid); // This should always be reset when `this._destination` is updated. this._numPositionUpdates = 0; } @@ -688,9 +685,6 @@ class PDFHistory { state.uid, /* removeTemporary = */ true ); - if (this._uid > this._maxUid) { - this._maxUid = this._uid; - } if (isValidRotation(destination.rotation)) { this.linkService.rotation = destination.rotation;