Skip to content

[Bug]: Annotations issue. TypeError: null is not an object (evaluating 'this.#touchMoveAC.abort') #19793

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ChrisMeye opened this issue Apr 9, 2025 · 5 comments · Fixed by #19797
Assignees
Labels

Comments

@ChrisMeye
Copy link

ChrisMeye commented Apr 9, 2025

Attach (recommended) or Link to PDF file

blank.pdf

Im using a simple plain blank pdf file. I have this issue with all pdf's. Its not document specific.

Web browser and its version

latest safari version on iPhone

Operating system and its version

iOS latest

PDF.js version

5.1.91 latest

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

Yes

Is a browser extension

No

Steps to reproduce the problem

If i draw in my pdf document i can provoke an error that i can basically only fix by restarting pdf.js.
Unfortunately I didnt figure out a way to reliably reproduce it every time but it happens really often and regularly nearly every time I try to draw. I see it happen most often if i zoom a bit draw something move around and draw again. Sometimes it happens immediately but sometimes it takes me a few drawings but definitely way to often to ignore. The error is happening as soon as i lift the finger after a I tried to draw a line (makes sense bcs its ontouchend).

"TypeError: null is not an object (evaluating 'this.#touchMoveAC.abort')"

Image

What is the expected behavior?

If i start to use annotations / drawings i can't move the page and I can no longer draw.

What went wrong?

Its hard to see but right at the beginning I zoom into the document and if i switch to annotation I cant draw bcs the console error appears. As written above sometimes like in this case right from the start sometimes it takes a few scribbles but defenetly in every session.

ScreenRecording_04-09-2025.17-15-34_1.mov

Link to a viewer

No response

Additional context

Bonus: If i debug and check the lines i can see this

Image

This is the context where the error happens so as you can see this.#touchmoveac is null therefore the error is valid

Image

@ChrisMeye ChrisMeye changed the title [Bug]: TypeError: null is not an object (evaluating 'this.#touchMoveAC.abort') [Bug]: Annotations issue. TypeError: null is not an object (evaluating 'this.#touchMoveAC.abort') Apr 9, 2025
@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Apr 9, 2025

Web browser and its version

latest safari version on iPhone

Operating system and its version

iOS latest

Can you reproduce this in any other browser, particularly in Firefox?


Also, please provide error messages and code as text rather than images.

@ChrisMeye
Copy link
Author

ChrisMeye commented Apr 9, 2025

Yes i can reproduce the same phenomenon on the iphone with the latest firefox app 137.0.0. In this case im using the latest unreleased pdf.js version: 5.2.47. From this page: "https://mozilla.github.io/pdf.js/web/viewer.html" bcs its easier for me to test.

As i dont have the same debug tools on the firefox mobile app i cant tell if its the same console error but its same behavior and consequence like in my previous safari tests. I can not longer draw the error happens after some zoom operations in combination with drawings. And other functions like text or text highlighting, annotations / drawing are not longer working. I tried same issue and same website with latest safari and have the same error:
TypeError: null is not an object (evaluating 'this.#touchMoveAC.abort')
This time i didnt even need to draw i just zoomed in and out "wildly" and the error popped up.

If you have an idea / something you want me to test im happy to do so.
This time i was even able to generate another error:
Unhandled Promise Rejection: TypeError: this.#currentEditorType.endDrawing is not a function. (In 'this.#currentEditorType.endDrawing(isAborted)', 'this.#currentEditorType.endDrawing' is undefined)

But i dont know if this one relates.

Both videos are firefox app 137.0.0. with the webpage mentioned above. Sorry for the shitty quality but otherwise file size is too big. But after some drawing i wasn't able to draw its just moving the page.

ScreenRecording_04-09-2025.18-09-25_1.mov

In the 2nd video you can see that the drawing in general is at the beginning weird and okayish and than after some time i cant draw at all.

ScreenRecording_04-09-2025.18-12-34_1-1.mov

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Apr 9, 2025

Yes i can reproduce the same phenomenon on the iphone with the latest firefox app 137.0.0.

Please note that all browsers on iOS are effectively reskinned versions of Safari, because of limitations/restrictions in that platform.

Hence the more relevant question here, can you reproduce this issue anywhere other than on iOS devices?


Please note that Safari in general, even more so on iOS, has a lot of issues not found in other browsers. Hence why we only list Safari as "mostly" supported: https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support

@ChrisMeye
Copy link
Author

ChrisMeye commented Apr 9, 2025

Yes im able to reproduce the error in chrome on my android tablet even tho i feel like its a bit more robust in chrome it didnt took me so long to reproduce. Basically same setup as before. I opened https://mozilla.github.io/pdf.js/web/viewer.html in chrome on my android and tried to zoom and used some annotations. I clearly see some kind of pattern but i can not pin point it yet. But its definitely the combination of zooming and annotations that are causing this.

Uncaught (in promise) TypeError: this[#currentEditorType].endDrawing is not a function
at AnnotationEditorLayer.endDrawingSession (annotation_editor_layer.js:868:36)
at AnnotationEditorLayer.commitOrRemove (annotation_editor_layer.js:889:12)
at AnnotationEditorUIManager.unselectAll (tools.js:2210:38)
at AnnotationEditorUIManager.updateMode (tools.js:1699:10)
at async updater (pdf_viewer.js:2412:7)

In chrome i always get this error. I got the same one in safari too as stated above but more often i got in safari:
TypeError: null is not an object (evaluating 'this.#touchMoveAC.abort')
And i mean I understand that safari is not so predictable but would it really crash so badly with such a determine error message?

@calixteman
Copy link
Contributor

There are two bugs here:

  • the first one I don't really understand is because we're trying to abort an already aborted signal... It's easy to fix (even if I don't understand why).
  • the second one can be intermittently reproduced while drawing on a touch screen and quickly click on an other tool button. In this case the current editor isn't committed (so we're still in drawing mode), we update the mode and then we want to commit the current drawing but the mode has been changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants