Skip to content

[Bug]: Opening a PDF file with page labels causes a TypeError to be logged #20520

@timvandermeij

Description

@timvandermeij

Attach (recommended) or Link to PDF file

issue3115r.pdf from the test suite

Web browser and its version

Firefox 146.0.1

Operating system and its version

Arch Linux

PDF.js version

5.4.506

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem

  1. Open issue3115r.pdf from the test suite with https://mozilla.github.io/pdf.js/web/viewer.html.
  2. Notice that the following traceback appears in the web console:
Uncaught (in promise) TypeError: can't access property "setAttribute", this.anchor is undefined
    setPageLabel pdf_thumbnail_view.js:452
    setPageLabels pdf_thumbnail_viewer.js:274
    _initializePageLabels app.js:1823
    load app.js:1635
    open app.js:1242
    promise callback*open app.js:1240
    onFileInputChange app.js:2455
    dispatch event_utils.js:115
    run app.js:816
    run app.js:811
    webViewerLoad viewer.js:332
    <anonymous> viewer.js:343
pdf_thumbnail_view.js:452:5

What is the expected behavior?

No traceback is logged

What went wrong?

A traceback is logged, and the setPageLabel is possibly not completed correctly

Link to a viewer

No response

Additional context

I stumbled upon this in the logs at http://54.241.84.105:8877/0a724729a13d72f/output.txt in the scope of PR #20519.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions