Fix a regression that (effectively) makes PDFHistory.forward
a no-op
*It appears that this accidentally broken in PR 8775.* Note that `PDFHistory.forward` is only used with certain named actions, and these aren't that commonly used, which ought to explain why this error managed to sneak in. Steps to reproduce the issue (and verify the fix): 1. Navigate to e.g. http://mirrors.ctan.org/info/lshort/english/lshort.pdf 2. Click on a couple of links, or outline items, such that the history is populated with a few entries. 3. In the console, execute `PDFViewerApplication.pdfHistory.back()` one or more times, thus navigating back to a previous viewer position. 4. In the console, execute `PDFViewerApplication.pdfHistory.forward() one or more times. At the last step above, no (forward) navigation happens with the current `master`; now compare with this patch.
This commit is contained in:
parent
04d4faefc4
commit
e772124339
@ -109,7 +109,7 @@ class PDFHistory {
|
|||||||
this._currentHash = getCurrentHash();
|
this._currentHash = getCurrentHash();
|
||||||
this._numPositionUpdates = 0;
|
this._numPositionUpdates = 0;
|
||||||
|
|
||||||
this._uid = 0;
|
this._uid = this._maxUid = 0;
|
||||||
this._destination = null;
|
this._destination = null;
|
||||||
this._position = null;
|
this._position = null;
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ class PDFHistory {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let state = window.history.state;
|
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();
|
window.history.forward();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,6 +286,8 @@ class PDFHistory {
|
|||||||
window.history.replaceState(newState, '', document.URL);
|
window.history.replaceState(newState, '', document.URL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
this._maxUid = this._uid;
|
||||||
|
|
||||||
if (typeof PDFJSDev !== 'undefined' &&
|
if (typeof PDFJSDev !== 'undefined' &&
|
||||||
PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
|
PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
|
||||||
// Providing the third argument causes a SecurityError for file:// URLs.
|
// Providing the third argument causes a SecurityError for file:// URLs.
|
||||||
|
Loading…
Reference in New Issue
Block a user