mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
47.14k stars 9.82k forks source link

Fix `dumpio: true` logs about `Script terminated by timeout` #18265

Closed timvandermeij closed 2 weeks ago

timvandermeij commented 2 weeks ago

In PR #18260 we enabled dumpio: true for Puppeteer. This option forwards the browser logs to Node's log stream so that we can see any warnings/errors that are logged in e.g. the web console. This surfaced a few interesting issues that we should fix before we enable that further due to the spammy nature of said logs.

This issue tracks the following often repeated log from http://54.241.84.105:8877/34fcd127eefeaf9/output.txt:

JavaScript warning: http://127.0.0.1:41223/build/generic/web/viewer.mjs, line 5808: Script terminated by timeout at:
#pageHide@http://127.0.0.1:41223/build/generic/web/viewer.mjs:5808:3
EventListener.handleEvent*#bindEvents@http://127.0.0.1:41223/build/generic/web/viewer.mjs:5823:12
initialize@http://127.0.0.1:41223/build/generic/web/viewer.mjs:5458:21
_initializePdfHistory@http://127.0.0.1:41223/build/generic/web/viewer.mjs:13144:21
load/</<@http://127.0.0.1:41223/build/generic/web/viewer.mjs:12889:14
promise callback*load/<@http://127.0.0.1:41223/build/generic/web/viewer.mjs:12887:109

Note that this particular traceback, in #pageHide, is most common, but there are also tracebacks that occur in other places with the same termination warning.

We should find out why this is logged after pretty much every test.

Snuffleupagus commented 2 weeks ago

Maybe after each integrationtest, before closing the tab, we could run (and await) PDFViewerApplication.close() since I believe that doing so would avoid these warnings.