@@ -534,11 +534,15 @@ const PDFViewerApplication = {
534
534
} ) ;
535
535
pdfRenderingQueue . setThumbnailViewer ( this . pdfThumbnailViewer ) ;
536
536
537
- this . pdfHistory = new PDFHistory ( {
538
- linkService : pdfLinkService ,
539
- eventBus,
540
- } ) ;
541
- pdfLinkService . setHistory ( this . pdfHistory ) ;
537
+ // The browsing history is only enabled when the viewer is standalone,
538
+ // i.e. not when it is embedded in a web page.
539
+ if ( ! this . isViewerEmbedded && ! AppOptions . get ( "disableHistory" ) ) {
540
+ this . pdfHistory = new PDFHistory ( {
541
+ linkService : pdfLinkService ,
542
+ eventBus,
543
+ } ) ;
544
+ pdfLinkService . setHistory ( this . pdfHistory ) ;
545
+ }
542
546
543
547
if ( ! this . supportsIntegratedFind ) {
544
548
this . findBar = new PDFFindBar ( appConfig . findBar , eventBus , this . l10n ) ;
@@ -1631,9 +1635,7 @@ const PDFViewerApplication = {
1631
1635
* @private
1632
1636
*/
1633
1637
_initializePdfHistory ( { fingerprint, viewOnLoad, initialDest = null } ) {
1634
- if ( this . isViewerEmbedded || AppOptions . get ( "disableHistory" ) ) {
1635
- // The browsing history is only enabled when the viewer is standalone,
1636
- // i.e. not when it is embedded in a web page.
1638
+ if ( ! this . pdfHistory ) {
1637
1639
return ;
1638
1640
}
1639
1641
this . pdfHistory . initialize ( {
@@ -2456,7 +2458,7 @@ function webViewerHashchange(evt) {
2456
2458
}
2457
2459
if ( ! PDFViewerApplication . isInitialViewSet ) {
2458
2460
PDFViewerApplication . initialBookmark = hash ;
2459
- } else if ( ! PDFViewerApplication . pdfHistory . popStateInProgress ) {
2461
+ } else if ( ! PDFViewerApplication . pdfHistory ? .popStateInProgress ) {
2460
2462
PDFViewerApplication . pdfLinkService . setHash ( hash ) ;
2461
2463
}
2462
2464
}
0 commit comments