mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
The reason that this code can be moved is that the `if (this.loading && page === 1)` check, in the `pagechange` event handler in viewer.js, is never satisfied since `this.loading` is not defined in that scope. This *could* be considered a regression from PR 5295, since prior to that `this.loading` was using the `PDFViewerApplication` scope (or `PDFView` as it were). However, I don't think that we need to fix that since we've been shipping this code in no less than *three* Firefox releases (uplifted in https://bugzilla.mozilla.org/show_bug.cgi?id=1084158), without breaking the world. An explanation of why the `pagechange` code works, despite `this.loading === undefined`, is that `set currentPageNumber` (in `PDFViewer`) returns early whenever `this.pdfDocument` isn't set. This check is, for all intents and purposes, functionally equivalent to checking `PDFViewerApplication.loading`. Hence we can move the page switching code into `PDFViewer`, and also remove `PDFViewerApplication.loading` since it's not used any more. (The `this.loading` property was added in PR 686, which was before the current viewer even existed.) *Note:* The changes in this patch should also be beneficial to the viewer `components`, since requiring every implementer to provide their own `pagechange` event handler just to get `PDFViewer.currentPageNumber` to actually work seems like an unnecessary complication. |
||
---|---|---|
.. | ||
images | ||
.gitignore | ||
annotations_layer_builder.js | ||
chromecom.js | ||
compatibility.js | ||
compressed.tracemonkey-pldi-09.pdf | ||
debugger.js | ||
default_preferences.js | ||
download_manager.js | ||
firefoxcom.js | ||
grab_to_pan.js | ||
hand_tool.js | ||
interfaces.js | ||
mozPrintCallback_polyfill.js | ||
overlay_manager.js | ||
password_prompt.js | ||
pdf_attachment_view.js | ||
pdf_document_properties.js | ||
pdf_find_bar.js | ||
pdf_find_controller.js | ||
pdf_history.js | ||
pdf_link_service.js | ||
pdf_outline_view.js | ||
pdf_page_view.js | ||
pdf_presentation_mode.js | ||
pdf_rendering_queue.js | ||
pdf_thumbnail_view.js | ||
pdf_thumbnail_viewer.js | ||
pdf_viewer.component.js | ||
pdf_viewer.css | ||
pdf_viewer.js | ||
preferences.js | ||
secondary_toolbar.js | ||
text_layer_builder.css | ||
text_layer_builder.js | ||
ui_utils.js | ||
view_history.js | ||
viewer-snippet-chrome-extension.html | ||
viewer-snippet-firefox-extension.html | ||
viewer-snippet-minified.html | ||
viewer-snippet-mozPrintCallback-polyfill.html | ||
viewer-snippet.html | ||
viewer.css | ||
viewer.html | ||
viewer.js |