Browse Source

Prevent errors if the 'resize' event is fired before the `eventBus` has been initialized

When opening a PDF file that triggers the browser fallback bar in the Firefox addon/built-in version, e.g. http://web.archive.org/web/20110918100215/http://www.irs.gov/pub/irs-pdf/f1040.pdf (with forms *disabled*), and then reloading the document an error can be thrown.
The reason is that displaying the fallback bar triggers 'resize' events, and they can arrive *before* the viewer has had a chance to run all the necessary initialization code.
Jonas Jenwald 9 years ago
parent
commit
1a2f142a14
  1. 3
      web/app.js

3
web/app.js

@ -1803,6 +1803,9 @@ function webViewerUpdateViewarea(e) { @@ -1803,6 +1803,9 @@ function webViewerUpdateViewarea(e) {
}
window.addEventListener('resize', function webViewerResize(evt) {
if (!PDFViewerApplication.eventBus) {
return;
}
PDFViewerApplication.eventBus.dispatch('resize');
});

Loading…
Cancel
Save