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

Add a BasePreferences.getAll method and use it to fetch all Preferences at once in PDFViewerApplication._readPreferences; ensure that the externalLinkTarget option is correctly set when the viewer is embedded #9917

Merged
merged 3 commits into from
Jul 25, 2018

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Jul 23, 2018

Please refer to the individual commit messages for additional details.

@timvandermeij The first patch fixes a (small) regression from PR #9479, hence this one should probably be included in the updated 2.0.xyz release too (as tracked in https://github.com/mozilla/pdf.js/projects/5).

@Snuffleupagus Snuffleupagus changed the title Add a BasePreferences.getAll menthod and use it to fetch all Preferences at once in PDFViewerApplication._readPreferences; and ensure that the externalLinkTarget option is correctly set when the viewer is embedded Add a BasePreferences.getAll method and use it to fetch all Preferences at once in PDFViewerApplication._readPreferences; ensure that the externalLinkTarget option is correctly set when the viewer is embedded Jul 23, 2018
@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://54.215.176.217:8877/03703f47f0e9343/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/03703f47f0e9343/output.txt

Total script time: 4.90 mins

Published

… viewer is embedded (PR 9479 follow-up)

*This was a stupid error on my part; sorry about breaking this!*

With the current code, the value of the `externalLinkTarget` option is now (potentially) updated *after* the viewer components have been initialized. For the "viewer in iframe/object tag" case, the result is that the value of the `externalLinkTarget` option isn't adjusted as intended any more.
…plication._readPreferences`

The only reason that this check ever existed in the first place, is that originally there was a global `PDFJS.openExternalLinkInNewWindow` option which was then subsumed by the (more generic) `PDFJS.externalLinkTarget` option. (The `externalLinkTarget` has since been moved into a `PDFLinkService` option, as part of PDF.js version `2.0`.)

Hence, during the period where both `PDFJS.openExternalLinkInNewWindow` and `PDFJS.externalLinkTarget` existed side-by-side, there was a need to allow the former one to override the latter one (for backward compatibility purposes). However, that's no longer the case, and this extra `externalLinkTarget` check can now be removed.
…nces at once in `PDFViewerApplication._readPreferences`

Given that *all* Preferences are already fetched in `PDFViewerApplication._readPreferences`, the amount of boilerplate/duplication can be considerably reduced with the addition of a `BasePreferences.getAll` method.
@Snuffleupagus Snuffleupagus force-pushed the Preference-getAll branch 2 times, most recently from b9c4171 to 34957ec Compare July 25, 2018 14:03
@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://54.215.176.217:8877/3171e73b8a8aaf7/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/3171e73b8a8aaf7/output.txt

Total script time: 4.70 mins

Published

@timvandermeij timvandermeij merged commit 3f4c2d6 into mozilla:master Jul 25, 2018
@timvandermeij
Copy link
Contributor

Much simpler; thanks!

@Snuffleupagus Snuffleupagus deleted the Preference-getAll branch July 25, 2018 20:52
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