1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Merge pull request #19557 from Snuffleupagus/PDFViewer-cleanupTimeouts

Abort various timeouts, in `PDFViewer`, when closing the document (PR 19128 follow-up)
This commit is contained in:
Jonas Jenwald 2025-02-27 11:17:02 +01:00 committed by GitHub
commit 4a48a7ec0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1173,6 +1173,7 @@ class PDFViewer {
this.#hiddenCopyElement?.remove();
this.#hiddenCopyElement = null;
this.#cleanupTimeouts();
this.#cleanupSwitchAnnotationEditorMode();
}
@ -2340,6 +2341,17 @@ class PDFViewer {
]);
}
#cleanupTimeouts() {
if (this.#scaleTimeoutId !== null) {
clearTimeout(this.#scaleTimeoutId);
this.#scaleTimeoutId = null;
}
if (this.#scrollTimeoutId !== null) {
clearTimeout(this.#scrollTimeoutId);
this.#scrollTimeoutId = null;
}
}
#cleanupSwitchAnnotationEditorMode() {
this.#switchAnnotationEditorModeAC?.abort();
this.#switchAnnotationEditorModeAC = null;
@ -2466,14 +2478,8 @@ class PDFViewer {
for (const pageView of this._pages) {
pageView.update(updateArgs);
}
if (this.#scaleTimeoutId !== null) {
clearTimeout(this.#scaleTimeoutId);
this.#scaleTimeoutId = null;
}
if (this.#scrollTimeoutId !== null) {
clearTimeout(this.#scrollTimeoutId);
this.#scrollTimeoutId = null;
}
this.#cleanupTimeouts();
if (!noUpdate) {
this.update();
}