From 1fab63724776ce65cf22d90f1f348e1317d0b811 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 3 Dec 2019 20:53:00 +0100 Subject: [PATCH] Prevent `if (!state || false) {` in the output, in `PDFHistory._popState`, for e.g. MOZCENTRAL builds By re-ordering the condition, which includes a `PDFJSDev` check, we can avoid meaningless output in the built files. --- web/pdf_history.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/pdf_history.js b/web/pdf_history.js index 0e4221aba..b28ce323d 100644 --- a/web/pdf_history.js +++ b/web/pdf_history.js @@ -527,9 +527,9 @@ class PDFHistory { let newHash = getCurrentHash(), hashChanged = this._currentHash !== newHash; this._currentHash = newHash; - if (!state || - (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME') && - state.chromecomState && !this._isValidState(state))) { + if ((typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME') && + state && state.chromecomState && !this._isValidState(state)) || + !state) { // This case corresponds to the user changing the hash of the document. this._uid++;