Skip to content
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

[src/core/worker.js] Remove a useless Promise handler from the pdfManagerReady function #12135

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Jul 28, 2020

Looking carefully at this code, you'll notice that the loadDocument function has no less than three Promise handling functions. This obviously makes no sense, since a Promise can only have one resolve and one reject handler.

Hence the final onFailure-case is unreachable, which only serves to add confusion when reading the code. Note that this code has been re-factored more than once over the years, but it seems as if this may even have been incorrect already in PR #3310 (and no-one have noticed for seven years :-).

Smaller diff with https://github.com/mozilla/pdf.js/pull/12135/files?diff=split&w=1

…nagerReady` function

Looking carefully at this code, you'll notice that the `loadDocument` function has no less than *three* Promise handling functions. This obviously makes no sense, since a Promise can only have one resolve and one reject handler.

Hence the final `onFailure`-case is unreachable, which only serves to add confusion when reading the code. Note that this code has been re-factored more than once over the years, but it seems as if this may even have been incorrect already in PR 3310 (and no-one have noticed for seven years :-).
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/1f5ebfef2b4a7b9/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.215.176.217:8877/666d76c4bc99ffb/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/1f5ebfef2b4a7b9/output.txt

Total script time: 26.69 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://54.67.70.0:8877/1f5ebfef2b4a7b9/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.215.176.217:8877/666d76c4bc99ffb/output.txt

Total script time: 29.84 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://54.215.176.217:8877/666d76c4bc99ffb/reftest-analyzer.html#web=eq.log

@timvandermeij timvandermeij merged commit bcbbd03 into mozilla:master Jul 28, 2020
@timvandermeij
Copy link
Contributor

Ha, nice catch!

@Snuffleupagus Snuffleupagus deleted the pdfManagerReady-loadDocument-promise branch July 29, 2020 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants