Skip to content

Commit

Permalink
sentry: Improve logging for events mysteriously targeting text nodes.
Browse files Browse the repository at this point in the history
Signed-off-by: Anders Kaseorg <anders@zulip.com>
  • Loading branch information
andersk committed Apr 11, 2024
1 parent b6473de commit 96be3a5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@
},
"patchedDependencies": {
"source-sans@3.46.0": "patches/source-sans@3.46.0.patch",
"eslint-plugin-no-jquery@2.7.0": "patches/eslint-plugin-no-jquery@2.7.0.patch"
"eslint-plugin-no-jquery@2.7.0": "patches/eslint-plugin-no-jquery@2.7.0.patch",
"@sentry/utils@7.109.0": "patches/@sentry__utils@7.109.0.patch"
}
},
"nyc": {
Expand Down
14 changes: 14 additions & 0 deletions patches/@sentry__utils@7.109.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/esm/object.js b/esm/object.js
index c63c1777dca0efb8b0e615da57dd9e8f2017ed32..bc57d870811e8af591f966a87b02f319d8bd13ac 100644
--- a/esm/object.js
+++ b/esm/object.js
@@ -133,6 +133,9 @@ function convertToPlainObject(
/** Creates a string representation of the target of an `Event` object */
function serializeEventTarget(target) {
try {
+ if (target instanceof Text) {
+ return htmlTreeAsString(target.parentElement) + " > ::text";
+ }
return isElement(target) ? htmlTreeAsString(target) : Object.prototype.toString.call(target);
} catch (_oO) {
return '<unknown>';
20 changes: 12 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 96be3a5

Please sign in to comment.