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

In GENERIC builds, dispatch a "webviewerloaded" event (from the webViewerLoad function) before initializing the viewer #10318

Merged
merged 2 commits into from
Nov 30, 2018

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Nov 29, 2018

  • Replace the OVERRIDES list in PDFViewerApplication._readPreferences with a disablePreferences, in GENERIC builds, `AppOption instead

    Rather than having a (somewhat) randomly choosen list of Preferences which AppOptions are allowed to override, it makes much more sense to simply add an AppOption to allow custom implementations to ignore Preferences altogether (it's also inline with the AppOption that allows the ViewHistory to be bypassed on load).

  • In GENERIC builds, dispatch a "webviewerloaded" event (from the webViewerLoad function) before initializing the viewer

    With the removal of the global PDFJS object, in PDF.js version 2.0, the viewer options are no longer as easily accessible as they previously were (and issues have been filed about this).
    In particular, since the viewer files aren't necessarily loaded immediately, this means that PDFViewerApplication/PDFViewerApplicationOptions aren't necessarily available directly. By dispatching an event once all viewer files are loaded but before the viewer initialization has run, setting AppOptions during load (in custom implementations of the default viewer) should hopefully become a little bit easier[1].

/cc @timvandermeij


[1] In hindsight, this should probably have been implemented when the global PDFJS object was removed...

…s` with a `disablePreferences`, in `GENERIC` builds, `AppOption instead

Rather than having a (somewhat) randomly choosen list of Preferences which `AppOptions` are allowed to override, it makes much more sense to simply add an AppOption to allow custom implementations to ignore Preferences altogether (it's also inline with the AppOption that allows the `ViewHistory` to be bypassed on load).
@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/f717837fd8c65cf/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/f717837fd8c65cf/output.txt

Total script time: 2.20 mins

Published

web/viewer.js Outdated Show resolved Hide resolved
…bViewerLoad` function) before initializing the viewer

With the removal of the global `PDFJS` object, in PDF.js version `2.0`, the viewer options are no longer as easily accessible as they previously were (and issues have been filed about this).
In particular, since the viewer files aren't necessarily loaded *immediately*, this means that `PDFViewerApplication`/`PDFViewerApplicationOptions` aren't necessarily available directly. By dispatching an event once all viewer files are loaded but *before* the viewer initialization has run, setting `AppOptions` during load (in custom implementations of the default viewer) should hopefully become a little bit easier[1].

---
[1] In hindsight, this should probably have been implemented when the global `PDFJS` object was removed...
@Snuffleupagus Snuffleupagus changed the title In GENERIC builds, dispatch a "webviewerload" event (from the corresponding function) before initializing the viewer In GENERIC builds, dispatch a "webviewerloaded" event (from the webViewerLoad function) before initializing the viewer Nov 30, 2018
@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/20bc7b7f0849a1e/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/20bc7b7f0849a1e/output.txt

Total script time: 2.13 mins

Published

@timvandermeij timvandermeij merged commit c91f437 into mozilla:master Nov 30, 2018
@timvandermeij
Copy link
Contributor

Thank you for improving this!

@Snuffleupagus Snuffleupagus deleted the disablePreferences branch December 1, 2018 10:17
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