Add PDFJS.abortGetDocument function to enable cancelling of calls to PDFJS.getDocument#5234
Closed
Snuffleupagus wants to merge 4 commits intomozilla:masterfrom
Snuffleupagus:abortGetDocument
Closed
Add PDFJS.abortGetDocument function to enable cancelling of calls to PDFJS.getDocument#5234Snuffleupagus wants to merge 4 commits intomozilla:masterfrom Snuffleupagus:abortGetDocument
Snuffleupagus wants to merge 4 commits intomozilla:masterfrom
Snuffleupagus:abortGetDocument
Conversation
Contributor
|
this might also fix #4774 - a colleague was able to reproduce it, if you make a preview we can try to verify. |
Collaborator
Author
From: Bot.io (Windows)ReceivedCommand cmd_preview from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.22.172.223:8877/33065e59e9a7697/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/33065e59e9a7697/output.txt Total script time: 0.89 mins Published
|
Closed
Currently when an exception is thrown, we try to reject `workerReadyCapability` with multiple arguments in src/core/api.js. This obviously doesn't work, hence this patch changes that to instead reject with the exception object as is. In src/core/worker.js the exception is currently (unncessarily) wrapped in an object, so this patch also simplifies that to directly send the exception object instead.
…PDFJS.getDocument
…itsForPromiseResolved`and add a `waitsForPromiseRejected` function
Contributor
Contributor
|
#5275 was merged, you can rebase this now. |
Contributor
|
Blocked by #5554 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains a tentative patch to fix #3485 (and should also fix #5228, #4774).
I was slightly unsure of the best way to handle the rejection of
workerReadyCapability, since it's not easily available outside ofgetDocumentand I didn't just want to expose it inPDFJS.A caveat with this patch is that it's only possible to abort the current
getDocument, so if you have multiple ones active simultaneously this isn't going to work. Since this implementation should work fine when used in the generic viewer (e.g. for #5228), I don't know if it's really worth complicating the solution too much.One other thing to note here:
abortGetDocumentreally only makes sense whengetDocumentisn't resolved/rejected yet, since otherwise just callingdestroyis enough.When I started looking at this, I realized that our current exception handling code wasn't really working as intended (rejection with multiple arguments). The first commit fixes this, and I'd be happy to extract that into a separate PR if that's preferred.Submitted as a separate PR.@yurydelendik Please let me know if this PR heading in the right direction, or if you'd prefer a different/modified solution!