Closed Bug 1209190 Opened 9 years ago Closed 27 days ago

Assigning ternary operator to innerHTML isn't flagged

Categories

(addons.mozilla.org Graveyard :: Add-on Validation, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: jwkbugzilla, Unassigned)

Details

I noticed that innerHTML in some minified code wasn't flagged by the validator. After some reducing, the validator apparently doesn't consider the following dynamic:

  a.innerHTML=(true?x:x)+""

This might be the same as bug 1197206, impossible to tell without real info over there.
Looking a bit into this, conditional expressions apparently aren't being processed at all, so that their value is considered to be None. While that isn't considered a literal by itself, the processing of the binary + operator will convert None into an empty string - so the result of adding a string to a ternary operator is always considered to be a string.

The same issue exists with the sequence expression, its value isn't being determined either - so the following won't trigger any warnings:

  a.innerHTML=(y,x)+""

Also logical expression:

  a.innerHTML=(true&&x)+""

And yield expression:

  function* foo()
  {
    a.innerHTML=(yield getHTML())+""
  }


And array comprehension:

  a.innerHTML=[for (x of [foo, bar]) x]+""

While update expressions and generator comprehensions aren't handled either, these don't seem important in this context.
Summary: Assigning ternary operator to innerHTML isn't be flagged → Assigning ternary operator to innerHTML isn't flagged
Product: addons.mozilla.org → addons.mozilla.org Graveyard
Status: NEW → RESOLVED
Closed: 27 days ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.