1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Merge pull request #19854 from calixteman/fix_find_in_tests

Fix errors when running the integration tests
This commit is contained in:
calixteman 2025-04-24 11:27:03 +02:00 committed by GitHub
commit 91175dc67d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -771,6 +771,9 @@ class PDFFindController {
}
#calculateMatch(pageIndex) {
if (!this.#state) {
return;
}
const query = this.#query;
if (query.length === 0) {
return; // Do nothing: the matches should be wiped out already.
@ -882,12 +885,17 @@ class PDFFindController {
let deferred = Promise.resolve();
const textOptions = { disableNormalization: true };
const pdfDoc = this._pdfDocument;
for (let i = 0, ii = this._linkService.pagesCount; i < ii; i++) {
const { promise, resolve } = Promise.withResolvers();
this._extractTextPromises[i] = promise;
deferred = deferred.then(() =>
this._pdfDocument
deferred = deferred.then(async () => {
if (pdfDoc !== this._pdfDocument) {
resolve();
return;
}
await pdfDoc
.getPage(i + 1)
.then(pdfPage => pdfPage.getTextContent(textOptions))
.then(
@ -920,8 +928,8 @@ class PDFFindController {
this._hasDiacritics[i] = false;
resolve();
}
)
);
);
});
}
}