Skip to content

Make sure the scripting manager is correctly reset when setting a null document #19910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

calixteman
Copy link
Contributor

It should fix the error:

JavaScript warning: http://127.0.0.1:35021/build/generic/build/pdf.sandbox.mjs, line 192: Script terminated by timeout at:
dispatchEvent@http://127.0.0.1:35021/build/generic/build/pdf.sandbox.mjs:192:3
dispatchEventInSandbox/<@http://127.0.0.1:35021/build/generic/web/viewer.mjs:3177:30
setTimeout handler*dispatchEventInSandbox@http://127.0.0.1:35021/build/generic/web/viewer.mjs:3177:15
async*#dispatchPageClose@http://127.0.0.1:35021/build/generic/web/viewer.mjs:8409:50
async*setDocument/<@http://127.0.0.1:35021/build/generic/web/viewer.mjs:8172:36
dispatch@http://127.0.0.1:35021/build/generic/web/viewer.mjs:1398:15
setDocument@http://127.0.0.1:35021/build/generic/web/viewer.mjs:12172:21
close@http://127.0.0.1:35021/build/generic/web/viewer.mjs:15563:22
testingClose@http://127.0.0.1:35021/build/generic/web/viewer.mjs:16357:51

@calixteman
Copy link
Contributor Author

/botio integrationtest

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_integrationtest from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/ba1f79cd468c51c/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_integrationtest from @calixteman received. Current queue size: 0

Live output at: http://54.193.163.58:8877/caa6956f5682ca4/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/ba1f79cd468c51c/output.txt

Total script time: 12.89 mins

  • Integration Tests: FAILED

@calixteman calixteman marked this pull request as draft May 9, 2025 17:13
@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented May 9, 2025

Please note that we should already be awaiting scripting to be destroyed via

get destroyPromise() {
return this.#destroyCapability?.promise || null;
}
which is used in

pdf.js/web/app.js

Lines 1071 to 1074 in 293506a

promises.push(
this.pdfScriptingManager.destroyPromise,
this.passwordPrompt.close()
);
and then finally

pdf.js/web/app.js

Line 1088 in 293506a

await Promise.all(promises);

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/caa6956f5682ca4/output.txt

Total script time: 34.29 mins

  • Integration Tests: FAILED

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented May 9, 2025

I wonder if just removing the following code would possibly help here?
Given that the entire viewer is being destroyed, it seems more of less pointless (even if technically correct) to dispatch the "PageClose" and "WillClose" events when there's nothing that will actually handle them.

await this.#dispatchPageClose(this.#pdfViewer.currentPageNumber);
await this.#scripting?.dispatchEventInSandbox({
id: "doc",
name: "WillClose",
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants