From eec1bea1b4d910e1012d4de3ab6e477680f4ae15 Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Sun, 24 Aug 2025 18:22:59 +0200 Subject: [PATCH] [Editor] Don't use a null signal for the comment button This removes the following error from the integration test logs: ``` JavaScript error: http://127.0.0.1:59283/build/generic/build/pdf.mjs, line 3879: TypeError: EventTarget.addEventListener: 'signal' member of AddEventListenerOptions is not an object. ``` Fixes 636ff50. Extends 63651885. --- src/display/editor/comment.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/display/editor/comment.js b/src/display/editor/comment.js index da467d444..230ff0e55 100644 --- a/src/display/editor/comment.js +++ b/src/display/editor/comment.js @@ -39,12 +39,17 @@ class Comment { if (!this.#editor._uiManager.hasCommentManager()) { return null; } + const comment = (this.#commentButton = document.createElement("button")); comment.className = "comment"; comment.tabIndex = "0"; comment.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-button"); const signal = this.#editor._uiManager._signal; + if (!(signal instanceof AbortSignal) || signal.aborted) { + return comment; + } + comment.addEventListener("contextmenu", noContextMenu, { signal }); comment.addEventListener("pointerdown", event => event.stopPropagation(), { signal,