Remove an unnecessary variable in getPdfManager, in the src/core/worker.js file

Another tiny piece of clean-up, since adding a `catch`-handler to a Promise shouldn't require an intermediate variable.
This commit is contained in:
Jonas Jenwald 2022-11-17 15:19:40 +01:00
parent a2a200175f
commit 70d362f22c

View File

@ -303,7 +303,7 @@ class WorkerMessageHandler {
} }
cachedChunks = []; cachedChunks = [];
}; };
const readPromise = new Promise(function (resolve, reject) { new Promise(function (resolve, reject) {
const readChunk = function ({ value, done }) { const readChunk = function ({ value, done }) {
try { try {
ensureNotTerminated(); ensureNotTerminated();
@ -335,8 +335,7 @@ class WorkerMessageHandler {
} }
}; };
fullRequest.read().then(readChunk, reject); fullRequest.read().then(readChunk, reject);
}); }).catch(function (e) {
readPromise.catch(function (e) {
pdfManagerCapability.reject(e); pdfManagerCapability.reject(e);
cancelXHRs = null; cancelXHRs = null;
}); });