1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Return early in PDFViewerApplication._parseHashParameters when the hash is empty

For people running e.g. Firefox with the `pdfBugEnabled` preference set, to allow quick access to debugging tools, this method will obviously run for every opened PDF file. However, in most cases the URL hash is empty and we can thus skip most of the parsing and simply return early instead.
This commit is contained in:
Jonas Jenwald 2020-01-23 12:05:43 +01:00
parent 668a29aa45
commit 0f3e87911f

View file

@ -239,6 +239,7 @@ const PDFViewerApplication = {
},
/**
* Potentially parse special debugging flags in the hash section of the URL.
* @private
*/
async _parseHashParameters() {
@ -249,11 +250,12 @@ const PDFViewerApplication = {
) {
return undefined;
}
const waitOn = [];
// Special debugging flags in the hash section of the URL.
const hash = document.location.hash.substring(1);
const hashParams = parseQueryString(hash);
if (!hash) {
return undefined;
}
const hashParams = parseQueryString(hash),
waitOn = [];
if (
"disableworker" in hashParams &&