Browse Source

Prevent a temporary position from being added to the history while a destination is scrolled into view

Since e.g. zooming can occur when navigating to a new destionation, ensure that a resulting 'updateviewarea' event doesn't trigger adding of a *temporary* position to the browser history at a bad time.
Jonas Jenwald 8 years ago
parent
commit
b7c4d788ed
  1. 11
      web/pdf_history.js

11
web/pdf_history.js

@ -189,6 +189,17 @@ class PDFHistory {
hash, hash,
page: pageNumber, page: pageNumber,
}, forceReplace); }, forceReplace);
if (!this._popStateInProgress) {
// Prevent the browser history from updating while the new destination is
// being scrolled into view, to avoid potentially inconsistent state.
this._popStateInProgress = true;
// We defer the resetting of `this._popStateInProgress`, to account for
// e.g. zooming occuring when the new destination is being navigated to.
Promise.resolve().then(() => {
this._popStateInProgress = false;
});
}
} }
/** /**

Loading…
Cancel
Save