New issue
Advanced search Search tips

Issue 812008 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug

Blocking:
issue 784368



Sign in to add a comment

Tricium JS exception: Cannot read property 'email'

Project Member Reported by wyatta@google.com, Feb 13 2018

Issue description

Gerrit 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>

 

Comment 1 by agable@google.com, Feb 14 2018

Labels: -Pri-3 Pri-1
Owner: qyears...@chromium.org
Status: Assigned (was: Untriaged)
Blocking: 784368
Labels: Tricium
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.
Status: Started (was: Assigned)
Started CL: https://crrev.com/c/917822
Project Member

Comment 4 by bugdroid1@chromium.org, 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

Status: Fixed (was: Started)
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