mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
47.06k stars 9.81k forks source link

Errors shown in the web console after reopening a closed viewer tab #18196

Open timvandermeij opened 4 weeks ago

timvandermeij commented 4 weeks ago

Attach (recommended) or Link to PDF file here: any PDF works, but I used the default Tracemonkey PDF file that is opened when going to https://mozilla.github.io/pdf.js/web/viewer.html

Configuration:

Steps to reproduce the problem:

  1. Open a first tab with https://mozilla.github.io/pdf.js/web/viewer.html.
  2. Open a second tab (may be empty or navigated to any page).
  3. Close the first tab.
  4. Reopen the first tab with Right Click -> Reopen closed tab.
  5. Notice that the viewer is restored, but in the web console some uncaught errors appeared:
Uncaught Error: The AnnotationEditor is not enabled.
    set annotationEditorParams pdf_viewer.js:2265
    webViewerSwitchAnnotationEditorParams app.js:2402
    dispatch event_utils.js:115
    dispatchEvent annotation_editor_params.js:56
    bindListeners annotation_editor_params.js:66
pdf_viewer.js:2265:12
    set annotationEditorParams pdf_viewer.js:2265
    webViewerSwitchAnnotationEditorParams app.js:2402
    dispatch event_utils.js:115
    dispatchEvent annotation_editor_params.js:56
    bindListeners annotation_editor_params.js:66
Uncaught Error: The AnnotationEditor is not enabled.
    set annotationEditorParams pdf_viewer.js:2265
    webViewerSwitchAnnotationEditorParams app.js:2402
    dispatch event_utils.js:115
    dispatchEvent annotation_editor_params.js:56
    bindListeners annotation_editor_params.js:69
pdf_viewer.js:2265:12

What is the expected behavior? (add screenshot) No errors are shown in the web console.

What went wrong? (add screenshot) Errors (see the tracebacks above) are shown in the web console

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension): https://mozilla.github.io/pdf.js/web/viewer.html

timvandermeij commented 4 weeks ago

Note that I accidentally stumbled upon this and don't know if this actually causes problems in the viewer given that the annotation editor seems to work at first glance.