[src/core/worker.js] Remove a useless Promise handler from the pdfManagerReady function

Looking carefully at this code, you'll notice that the `loadDocument` function has no less than *three* Promise handling functions. This obviously makes no sense, since a Promise can only have one resolve and one reject handler.

Hence the final `onFailure`-case is unreachable, which only serves to add confusion when reading the code. Note that this code has been re-factored more than once over the years, but it seems as if this may even have been incorrect already in PR 3310 (and no-one have noticed for seven years :-).
This commit is contained in:
Jonas Jenwald 2020-07-28 14:33:39 +02:00
parent 403816040e
commit fbe90b63ec

View File

@ -371,14 +371,12 @@ class WorkerMessageHandler {
function pdfManagerReady() { function pdfManagerReady() {
ensureNotTerminated(); ensureNotTerminated();
loadDocument(false).then( loadDocument(false).then(onSuccess, function (reason) {
onSuccess,
function loadFailure(ex) {
ensureNotTerminated(); ensureNotTerminated();
// Try again with recoveryMode == true // Try again with recoveryMode == true
if (!(ex instanceof XRefParseException)) { if (!(reason instanceof XRefParseException)) {
onFailure(ex); onFailure(reason);
return; return;
} }
pdfManager.requestLoadedStream(); pdfManager.requestLoadedStream();
@ -387,9 +385,7 @@ class WorkerMessageHandler {
loadDocument(true).then(onSuccess, onFailure); loadDocument(true).then(onSuccess, onFailure);
}); });
}, });
onFailure
);
} }
ensureNotTerminated(); ensureNotTerminated();