Tricium JS exception: Cannot read property 'email' |
|||
Issue descriptionGerrit analytics showing a sudden increase in JS errors apparently coming from a tricium plugin with more thank 3k instances in the last 24h. The increase started two or three days ago. A typical stack trace is quoted below: Uncaught TypeError: Cannot read property 'email' of undefined, Stack trace: TypeError: Cannot read prop erty 'email' of undefined at HTMLElement.attached (https://chromium-review.googlesource.com/plugi ns/tricium/static/tricium-feedback-button.js:30:32) at https://cdn.googlesource.com/polygerrit_ui/45 3.0/elements/gr-app.js:1400:398 at Object.whenRe ady (https://cdn.googlesource.com/polygerrit_ui/4 53.0/elements/gr-app.js:1394:88) at HTMLElemen t.attachedCallback (https://cdn.googlesource.co m/polygerrit_ui/453.0/elements/gr-app.js:1400:23 5) at HTMLElement.attachedCallback (https://cd n.googlesource.com/polygerrit_ui/453.0/element s/gr-app.js:1432:426) at Object.appendChild (http s://cdn.googlesource.com/polygerrit_ui/453.0/ele ments/gr-app.js:1454:442) at DomApi.insertBefore (https://cdn.googlesource.com/polygerrit_ui/45 3.0/elements/gr-app.js:1464:256) at DomApi.appen dChild (https://cdn.googlesource.com/polygerrit_u i/453.0/elements/gr-app.js:1463:68) at HTMLElem ent._appendChild (https://cdn.googlesource.com/p olygerrit_ui/453.0/elements/gr-app.js:2655:364) at https://cdn.googlesource.com/polygerrit_ui/45 3.0/elements/gr-app.js:2653:62 at <anonymous>
,
Feb 14 2018
There are a couple issues here: (1) tricium-feedback-button.js is blindly trying to reference a property of an object before checking whether than object is undefined (2) tricium-feedback-button is being attached to every single Gerrit comment, not just robot comments or Tricium robot comments. I will now make a change to fix #1.
,
Feb 14 2018
,
Feb 14 2018
The following revision refers to this bug: https://chromium.googlesource.com/infra/gerrit-plugins/tricium/+/2f4c0e36439aaf1750fda64c2f38d385bb0fda62 commit 2f4c0e36439aaf1750fda64c2f38d385bb0fda62 Author: Quinten Yearsley <qyearsley@chromium.org> Date: Wed Feb 14 18:23:47 2018 Fix tricium-feedback-button attached() In the initial commit for tricium-feedback-button, there were several things not completely finished: - An extra unused `view` property was left in the element - The `init()` method was never called - `this.comment.author.email` was referenced without checking whether `this.comment.author` is undefined - There was no check for whether the comment is a robot comment, which is apparently needed since this gets attached to all comments. Bug: 812008 Change-Id: I1f5a44dda7c49861a78744568de989a9bebb636d Reviewed-on: https://chromium-review.googlesource.com/917822 Reviewed-by: Aaron Gable <agable@chromium.org> [modify] https://crrev.com/2f4c0e36439aaf1750fda64c2f38d385bb0fda62/test/tricium-feedback-button_test.html [modify] https://crrev.com/2f4c0e36439aaf1750fda64c2f38d385bb0fda62/src/main/resources/static/tricium-feedback-button.js
,
Feb 22 2018
Now this has been fixed in this particular case (waiting for it to roll out to prod) and a separate fix has been supported for the general issue of robot-comment-controls being attached in the DOM in all non-robot-comments. |
|||
►
Sign in to add a comment |
|||
Comment 1 by agable@google.com
, Feb 14 2018Owner: qyears...@chromium.org
Status: Assigned (was: Untriaged)