Closed Bug 1056020 Opened 10 years ago Closed 10 years ago

Bad typeof tests in email app.

Categories

(Firefox OS Graveyard :: Gaia::E-Mail, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: max, Unassigned)

Details

Three identical (presumably copy-pasted) bad typeof tests:

  - configurator.js:6383 (https://github.com/mozilla-b2g/gaia/blob/master/apps/email/js/ext/mailapi/composite/configurator.js#L6383)
  - mailparser.js:1709 (https://github.com/mozilla-b2g/gaia/blob/master/apps/email/js/ext/mailparser/mailparser.js#L1709)
  - pop3.js:2244 (https://github.com/mozilla-b2g/gaia/blob/master/apps/email/js/ext/pop3/pop3.js#L2244)

In each case, we have a test of the following form:

  if(typeof html !=" string"){

Note the extra space before "string", which prevents these tests from working properly.
Thanks for the detective work and bug report!  All three lines are from the same node.js library (mailparser) that gets built into the e-mail back-end's various "layers", so the good news is no copying and pasting going on!  Looking at the impacted files, it does seem like we may need to improve our layering setup since it should arguably not be present in those files quite like that.  (cc'ing :jrburke and :mcav for awareness on that aspect.)

The ever better news is I don't think the broken code impacts us since the values are already strings per the regular data-flow in the class.  And best news, we're replacing that library with a successor of itself in bug 885110.  The code currently in the tree is unlikely to work since it appears to try and run prior to quoted-printable and/or base64 decoding.  In the new library I think that is better addressed.

I'm going to resolve this WFM since the specific typeof tests aren't a problem for us.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.