[PDFHistory] Fix "Warning: Unhandled rejection: [Exception... "The operation is insecure."" when opening local file
This commit is contained in:
parent
5ecb407ca7
commit
ca8e3ea06f
@ -65,8 +65,7 @@ var PDFHistory = {
|
|||||||
// is opened in the web viewer.
|
// is opened in the web viewer.
|
||||||
this.reInitialized = true;
|
this.reInitialized = true;
|
||||||
}
|
}
|
||||||
window.history.replaceState({ fingerprint: this.fingerprint }, '',
|
this._pushOrReplaceState({ fingerprint: this.fingerprint }, true);
|
||||||
document.URL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
@ -131,6 +130,21 @@ var PDFHistory = {
|
|||||||
state.target && state.target.hash) ? true : false;
|
state.target && state.target.hash) ? true : false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_pushOrReplaceState: function pdfHistory_pushOrReplaceState(stateObj,
|
||||||
|
replace) {
|
||||||
|
// In Firefox, 'urlParam' needs to be undefined in order to prevent issues
|
||||||
|
// when local files are opened.
|
||||||
|
var urlParam;
|
||||||
|
//#if (GENERIC || CHROME)
|
||||||
|
urlParam = document.URL;
|
||||||
|
//#endif
|
||||||
|
if (replace) {
|
||||||
|
window.history.replaceState(stateObj, '', urlParam);
|
||||||
|
} else {
|
||||||
|
window.history.pushState(stateObj, '', urlParam);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
get isHashChangeUnlocked() {
|
get isHashChangeUnlocked() {
|
||||||
if (!this.initialized) {
|
if (!this.initialized) {
|
||||||
return true;
|
return true;
|
||||||
@ -291,11 +305,8 @@ var PDFHistory = {
|
|||||||
this._pushToHistory(previousParams, false, replacePrevious);
|
this._pushToHistory(previousParams, false, replacePrevious);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (overwrite || this.uid === 0) {
|
this._pushOrReplaceState(this._stateObj(params),
|
||||||
window.history.replaceState(this._stateObj(params), '', document.URL);
|
(overwrite || this.uid === 0));
|
||||||
} else {
|
|
||||||
window.history.pushState(this._stateObj(params), '', document.URL);
|
|
||||||
}
|
|
||||||
this.currentUid = this.uid++;
|
this.currentUid = this.uid++;
|
||||||
this.current = params;
|
this.current = params;
|
||||||
this.updatePreviousBookmark = true;
|
this.updatePreviousBookmark = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user