Skip to content

Commit 649a03f

Browse files
Merge pull request #20189 from timvandermeij/null-signal
[Editor] Don't use a null signal for the comment button
2 parents 535a042 + eec1bea commit 649a03f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/display/editor/comment.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,17 @@ class Comment {
3939
if (!this.#editor._uiManager.hasCommentManager()) {
4040
return null;
4141
}
42+
4243
const comment = (this.#commentButton = document.createElement("button"));
4344
comment.className = "comment";
4445
comment.tabIndex = "0";
4546
comment.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-button");
4647

4748
const signal = this.#editor._uiManager._signal;
49+
if (!(signal instanceof AbortSignal) || signal.aborted) {
50+
return comment;
51+
}
52+
4853
comment.addEventListener("contextmenu", noContextMenu, { signal });
4954
comment.addEventListener("pointerdown", event => event.stopPropagation(), {
5055
signal,

0 commit comments

Comments
 (0)