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:
commit
91175dc67d
1 changed files with 12 additions and 4 deletions
|
@ -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();
|
||||
}
|
||||
)
|
||||
);
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue