Skip to content

A couple of improvements of getDestination (unit-test included) #6187

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

Merged
merged 2 commits into from
Jul 13, 2015
Merged

A couple of improvements of getDestination (unit-test included) #6187

merged 2 commits into from
Jul 13, 2015

Conversation

Snuffleupagus
Copy link
Collaborator

Please refer to the individual commit messages.

Doing this helped uncover an issue with the `getDestination` implementation.
Currently if a named destination doesn't exist, the method (in `obj.js`) may return `undefined` which leads to the promise being stuck in a pending state.
*Note:* returning `null` for this case is consistent with other methods, e.g. `getOutline` and `getAttachments`.
For named destinations that are contained in a `Dict`, as opposed to a `NameTree`, we currently iterate through the *entire* dictionary just to fetch *one* destination.
This code appears to simply have been copy-pasted from the `get destinations` method, but in its current form it's quite unnecessary/inefficient since can just get the required destination directly instead.
@timvandermeij
Copy link
Contributor

Do you happen to have one or more PDF files that can be used for testing this? It looks good, but especially the second commit would be good to test with a file that has named destinations in a Dict.

@Snuffleupagus
Copy link
Collaborator Author

Do you happen to have one or more PDF files that can be used for testing this? It looks good, but especially the second commit would be good to test with a file that has named destinations in a Dict.

Apart from basicapi.pdf, which is already covered by existing (and added) tests, there's e.g. hmm.pdf and jai.pdf.

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://107.21.233.14:8877/50f811d2fbc5891/output.txt

@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/ad8d9ce2fc46d3f/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/7c2e2892057003c/output.txt

@timvandermeij timvandermeij self-assigned this Jul 13, 2015
@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/ad8d9ce2fc46d3f/output.txt

Total script time: 18.27 mins

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/7c2e2892057003c/output.txt

Total script time: 19.23 mins

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

timvandermeij added a commit that referenced this pull request Jul 13, 2015
…tion

A couple of improvements of `getDestination` (unit-test included)
@timvandermeij timvandermeij merged commit 1416a1b into mozilla:master Jul 13, 2015
@timvandermeij
Copy link
Contributor

Nice work, thank you!

@Snuffleupagus Snuffleupagus deleted the more-efficient-getDestination branch July 14, 2015 08:05
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.

3 participants