1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00
pdf.js/web
Jonas Jenwald ffeba9c630 Move the page switching code into set currentPageNumber in PDFViewer instead of placing it in the pagechange event handler
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.
2015-06-24 14:07:07 +02:00
..
images Add updated loading-small.png (and corresponding Retina) asset 2014-10-01 00:13:45 +02:00
.gitignore Remove obselete file from .gitignore 2015-01-26 16:44:45 +01:00
annotations_layer_builder.js Replaces text selection example 2014-12-20 23:41:34 -06:00
chromecom.js [CRX] Add Referer request header if needed 2015-06-05 23:24:40 +02:00
compatibility.js Merge pull request #5598 from CodingFabian/chrome39-range-disable 2015-04-30 22:31:50 +02:00
compressed.tracemonkey-pldi-09.pdf Add Makefile. Move some files around to make building the website easier. 2011-07-05 10:53:57 -07:00
debugger.js Fix regression that prevents downloading of font files in the debugger 2014-10-28 19:56:55 +01:00
default_preferences.js Implement streaming using moz-chunk-arraybuffer 2014-09-19 19:05:25 -05:00
download_manager.js Fixes DownloadManager for IE10 and above 2014-04-28 22:43:05 +02:00
firefoxcom.js cleaned whitespace 2015-02-17 11:07:37 -05:00
grab_to_pan.js Handtool: Remove focus from previous node on click 2014-09-03 16:31:47 +02:00
hand_tool.js Break dependencies between PresentationMode and other code, and add PresentationMode related utility methods to PDFViewer 2015-04-21 16:02:32 +02:00
interfaces.js Refactors PDFHistory. 2015-05-16 11:20:36 -05:00
mozPrintCallback_polyfill.js Check availability of canvas & PDF before printing 2015-06-05 23:55:08 +02:00
overlay_manager.js [OverlayManager] Add preventDefault to the keydown event handler 2014-05-27 23:48:02 +02:00
password_prompt.js Convert the existing overlays to use the OverlayManager 2014-05-25 21:33:15 +02:00
pdf_attachment_view.js Add custom |outlineloaded| and |attachmentsloaded| events to the viewer (bug 1112947) 2015-03-21 17:49:34 +01:00
pdf_document_properties.js Simplify document properties field logic 2015-04-27 15:25:40 +02:00
pdf_find_bar.js cleaned whitespace 2015-02-17 11:07:37 -05:00
pdf_find_controller.js Merge pull request #5769 from dumyan/findcontroller-nbsp 2015-02-28 14:50:25 +01:00
pdf_history.js [CRX] Add Referer request header if needed 2015-06-05 23:24:40 +02:00
pdf_link_service.js Fix a couple of function names in error messages in PDFLinkService 2015-05-29 13:47:28 +02:00
pdf_outline_view.js Add custom |outlineloaded| and |attachmentsloaded| events to the viewer (bug 1112947) 2015-03-21 17:49:34 +01:00
pdf_page_view.js Merge pull request #5857 from Rob--W/print-page-size 2015-05-14 16:52:40 +02:00
pdf_presentation_mode.js Preface all "fullscreen" CSS rules with a |pdfPresentationMode| class, and add it to the |viewerContainer| while Presentation Mode is active 2015-04-21 16:28:50 +02:00
pdf_rendering_queue.js Refactors draw method in PDFPageView; makes optional some PDFPageViewOptions options 2014-12-20 23:41:34 -06:00
pdf_thumbnail_view.js viewer: Support Retina/HiDPI thumbnails 2015-05-18 15:13:46 +01:00
pdf_thumbnail_viewer.js Update thumbnail style only when sidebar is visible 2015-01-27 21:08:36 +01:00
pdf_viewer.component.js Refactors PDFHistory. 2015-05-16 11:20:36 -05:00
pdf_viewer.css Preface all "fullscreen" CSS rules with a |pdfPresentationMode| class, and add it to the |viewerContainer| while Presentation Mode is active 2015-04-21 16:28:50 +02:00
pdf_viewer.js Move the page switching code into set currentPageNumber in PDFViewer instead of placing it in the pagechange event handler 2015-06-24 14:07:07 +02:00
preferences.js Adjust use of chrome.storage.managed for Opera 2014-09-06 00:37:30 +02:00
secondary_toolbar.js Simplify document properties field logic 2015-04-27 15:25:40 +02:00
text_layer_builder.css Replaces text selection example 2014-12-20 23:41:34 -06:00
text_layer_builder.js Add a |textlayerrendered| event 2015-01-06 17:57:32 +01:00
ui_utils.js Refactors PDFLinkService. 2015-05-16 11:20:36 -05:00
view_history.js Added Promise.catch 2014-05-22 13:53:19 -04:00
viewer-snippet-chrome-extension.html Remove type="text/javascript" from script tags. 2014-05-13 02:41:01 +02:00
viewer-snippet-firefox-extension.html Remove type="text/javascript" from script tags. 2014-05-13 02:41:01 +02:00
viewer-snippet-minified.html Remove type="text/javascript" from script tags. 2014-05-13 02:41:01 +02:00
viewer-snippet-mozPrintCallback-polyfill.html Revert PR 5510, except in WebKit browsers, for breaking print preview in Firefox 2015-03-07 00:16:55 +01:00
viewer-snippet.html Remove type="text/javascript" from script tags. 2014-05-13 02:41:01 +02:00
viewer.css Apply padding on <select> and not the button 2015-06-03 12:16:12 -07:00
viewer.html Refactors PDFLinkService. 2015-05-16 11:20:36 -05:00
viewer.js Move the page switching code into set currentPageNumber in PDFViewer instead of placing it in the pagechange event handler 2015-06-24 14:07:07 +02:00