Skip to content

[Bug]: Intermittent failure in the "must check that the computed value is correct" scripting integration test #20133

@timvandermeij

Description

@timvandermeij

Attach (recommended) or Link to PDF file

N/A

Web browser and its version

Firefox 141.0

Operating system and its version

Arch Linux

PDF.js version

5.4.54 (and current master)

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem

  1. Apply the following diff locally:
diff --git a/web/pdf_scripting_manager.js b/web/pdf_scripting_manager.js
index 402613f87..b6c183f77 100644
--- a/web/pdf_scripting_manager.js
+++ b/web/pdf_scripting_manager.js
@@ -279,6 +279,7 @@ class PDFScriptingManager {
   }
 
   async #updateFromSandbox(detail) {
+    await new Promise(r => setTimeout(r, 2000));
     const pdfViewer = this.#pdfViewer;
     // Ignore some events, see below, that don't make sense in PresentationMode.
     const isInPresentationMode =
  1. Run only the "must check that the computed value is correct" scripting integration test (using e.g. fit).
  2. Notice that the test fails (first found in http://54.193.163.58:8877/a9ee49e9c56d424/output.txt):
Failures:
1) Interaction Correctly format numbers must check that the computed value is correct
  Message:
�[31m    ProtocolError: script.callFunction timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.�[0m
  Stack:
        at <instance_members_initializer> (file:///C:/pdfjs/botio-files-pdfjs/private/a9ee49e9c56d424/node_modules/puppeteer-core/lib/esm/puppeteer/common/CallbackRegistry.js:98:14)
        at new Callback (file:///C:/pdfjs/botio-files-pdfjs/private/a9ee49e9c56d424/node_modules/puppeteer-core/lib/esm/puppeteer/common/CallbackRegistry.js:102:16)
        at CallbackRegistry.create (file:///C:/pdfjs/botio-files-pdfjs/private/a9ee49e9c56d424/node_modules/puppeteer-core/lib/esm/puppeteer/common/CallbackRegistry.js:21:26)
        at BidiConnection.send (file:///C:/pdfjs/botio-files-pdfjs/private/a9ee49e9c56d424/node_modules/puppeteer-core/lib/esm/puppeteer/bidi/Connection.js:51:32)
        at Session.send (file:///C:/pdfjs/botio-files-pdfjs/private/a9ee49e9c56d424/node_modules/puppeteer-core/lib/esm/puppeteer/bidi/core/Session.js:134:42)
        at Session.<anonymous> (file:///C:/pdfjs/botio-files-pdfjs/private/a9ee49e9c56d424/node_modules/puppeteer-core/lib/esm/puppeteer/util/decorators.js:101:27)
        at WindowRealm.callFunction (file:///C:/pdfjs/botio-files-pdfjs/private/a9ee49e9c56d424/node_modules/puppeteer-core/lib/esm/puppeteer/bidi/core/Realm.js:92:51)
        at WindowRealm.<anonymous> (file:///C:/pdfjs/botio-files-pdfjs/private/a9ee49e9c56d424/node_modules/puppeteer-core/lib/esm/puppeteer/util/decorators.js:101:27)
        at #evaluate (file:///C:/pdfjs/botio-files-pdfjs/private/a9ee49e9c56d424/node_modules/puppeteer-core/lib/esm/puppeteer/bidi/Realm.js:134:42)
        at BidiFrameRealm.evaluateHandle (file:///C:/pdfjs/botio-files-pdfjs/private/a9ee49e9c56d424/node_modules/puppeteer-core/lib/esm/puppeteer/bidi/Realm.js:101:36)

What is the expected behavior?

The test should not be timing-dependent and pass.

What went wrong?

The test is timing-dependent and doesn't pass if a delay is introduced.

Link to a viewer

No response

Additional context

Typing in the text field causes a sandbox event to trigger, which we should await. However, we currently don't do that, so we're continuing with the next actions before the sandbox event is actually processed.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions