1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Update puppeteer to version 22.0.0

This is a major version bump that requires two changes on our side:

- The new headless mode is now the default, so we can remove our
  transformation code (see https://github.com/puppeteer/puppeteer/pull/11815).
- The `page.waitForTimeout` API is removed. Sadly we still used it in
  the integration tests (but fortunately much less than before we worked
  on fixing intermittent failures), so until we remove the final
  occurrences we provide an implementation ourselves (see
  https://github.com/puppeteer/puppeteer/pull/11780).

The full changelog can be found here:
https://github.com/puppeteer/puppeteer/releases/tag/puppeteer-core-v22.0.0
This commit is contained in:
Tim van der Meij 2024-02-10 18:21:34 +01:00
parent 4feab0c1fa
commit 28418598e5
No known key found for this signature in database
GPG key ID: 8C3FD2925A5F2762
7 changed files with 72 additions and 60 deletions

View file

@ -85,11 +85,27 @@ function closePages(pages) {
);
}
function waitForTimeout(milliseconds) {
/**
* Wait for the given number of milliseconds.
*
* Note that waiting for an arbitrary time in tests is discouraged because it
* can easily cause intermittent failures, which is why this functionality is
* no longer provided by Puppeteer 22+ and we have to implement it ourselves
* for the remaining callers in the integration tests. We should avoid
* creating new usages of this function; instead please refer to the better
* alternatives at https://github.com/puppeteer/puppeteer/pull/11780.
*/
return new Promise(resolve => {
setTimeout(resolve, milliseconds);
});
}
async function clearInput(page, selector) {
await page.click(selector);
await kbSelectAll(page);
await page.keyboard.press("Backspace");
await page.waitForTimeout(10);
await waitForTimeout(10);
}
function getSelector(id) {
@ -276,7 +292,7 @@ async function serializeBitmapDimensions(page) {
async function dragAndDropAnnotation(page, startX, startY, tX, tY) {
await page.mouse.move(startX, startY);
await page.mouse.down();
await page.waitForTimeout(10);
await waitForTimeout(10);
await page.mouse.move(startX + tX, startY + tY);
await page.mouse.up();
await page.waitForSelector("#viewer:not(.noUserSelect)");
@ -487,5 +503,6 @@ export {
waitForSerialized,
waitForStorageEntries,
waitForTextLayer,
waitForTimeout,
waitForUnselectedEditor,
};