1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Merge pull request #19503 from Snuffleupagus/web-rm-some-eslint-disable

Remove a few `eslint-disable` statements in the `web/` folder
This commit is contained in:
Jonas Jenwald 2025-02-17 15:21:57 +01:00 committed by GitHub
commit affce70a09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 33 deletions

View file

@ -18,19 +18,13 @@ import { getPdfFilenameFromUrl } from "pdfjs-lib";
async function docProperties(pdfDocument) {
const url = "",
baseUrl = url.split("#", 1)[0];
// eslint-disable-next-line prefer-const
let { info, metadata, contentDispositionFilename, contentLength } =
const { info, metadata, contentDispositionFilename, contentLength } =
await pdfDocument.getMetadata();
if (!contentLength) {
const { length } = await pdfDocument.getDownloadInfo();
contentLength = length;
}
return {
...info,
baseURL: baseUrl,
filesize: contentLength,
filesize: contentLength || (await pdfDocument.getDownloadInfo()).length,
filename: contentDispositionFilename || getPdfFilenameFromUrl(url),
metadata: metadata?.getRaw(),
authors: metadata?.get("dc:creator"),

View file

@ -886,9 +886,8 @@ class PDFFindController {
const { promise, resolve } = Promise.withResolvers();
this._extractTextPromises[i] = promise;
// eslint-disable-next-line arrow-body-style
deferred = deferred.then(() => {
return this._pdfDocument
deferred = deferred.then(() =>
this._pdfDocument
.getPage(i + 1)
.then(pdfPage => pdfPage.getTextContent(textOptions))
.then(
@ -921,8 +920,8 @@ class PDFFindController {
this._hasDiacritics[i] = false;
resolve();
}
);
});
)
);
}
}

View file

@ -260,27 +260,25 @@ window.print = function () {
ensureOverlay().then(function () {
overlayManager.closeIfActive(dialog);
});
return; // eslint-disable-line no-unsafe-finally
} else {
const activeServiceOnEntry = activeService;
activeService
.renderPages()
.then(() => activeServiceOnEntry.performPrint())
.catch(() => {
// Ignore any error messages.
})
.then(() => {
// aborts acts on the "active" print request, so we need to check
// whether the print request (activeServiceOnEntry) is still active.
// Without the check, an unrelated print request (created after
// aborting this print request while the pages were being generated)
// would be aborted.
if (activeServiceOnEntry.active) {
abort();
}
});
}
const activeServiceOnEntry = activeService;
activeService
.renderPages()
.then(function () {
return activeServiceOnEntry.performPrint();
})
.catch(function () {
// Ignore any error messages.
})
.then(function () {
// aborts acts on the "active" print request, so we need to check
// whether the print request (activeServiceOnEntry) is still active.
// Without the check, an unrelated print request (created after aborting
// this print request while the pages were being generated) would be
// aborted.
if (activeServiceOnEntry.active) {
abort();
}
});
}
};