Closed Bug 1025711 Opened 7 years ago Closed 7 years ago

[email/sanitizer] Quiet bleach.js CSS parser errors

Categories

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

x86_64
Linux
defect
Not set
normal

Tracking

(b2g-v2.0 affected, b2g-v2.1 fixed)

RESOLVED FIXED
2.0 S4 (20june)
Tracking Status
b2g-v2.0 --- affected
b2g-v2.1 --- fixed

People

(Reporter: asuth, Assigned: asuth)

Details

Attachments

(1 file)

The CSS parser in bleach.js can get very upset with the CSS from emails we feed it and can output a lot of warnings/errors that we don't care about but could seem like things we care about.  Better to not log them at all.
Note that the CSS parser files for some reason have ^M's so the patches do too.  git diff may show this without conveying that they're everywhere.  I'm not doing anything about that in this patch.
Assignee: nobody → bugmail
Status: NEW → ASSIGNED
Attachment #8440469 - Flags: review?(jrburke)
Comment on attachment 8440469 [details] [review]
quiet CSS warnings/errors

Ideally, the modules would allow a "debug" flag or verbose option that would allow optionally printing these for deep debug cases, but given that this is a fork of an existing project, this is is a more targeted change.

I was hoping this would help with some errors I see for LinkedIn emails, but on closer inspection, these look like Gecko CSS parser warnings:

E/GeckoConsole( 6285): [JavaScript Warning: "Dangling combinator.  Ruleset ignored due to bad selector." {file: "app://email.gaiamobile.org/index.html#" line: 6 column: 17 source: "*[class].hero_bg ;}}*[class].bg_anniversary,*[class].bg_position ;}}*[class].bg_endorsement.digest,*[class].bg_skill ;}}*[class].bg_post ;}}*[class].bg_connection ;}}*[class].bg_otherprofileupdates ;}}*[class].bg_pictureshare ;}}*[class].hero_bg_ovr_none ;}}html { }}body { background-color: #DFDFDF; padding: 0; margin: 0; width: 100%; margin: 0 auto; }"}]

So, a separate thing. For the purpose of this ticket, r+ on the pull request. Tested on device with minification turned on.
Attachment #8440469 - Flags: review?(jrburke) → review+
Debug-wise, agreed.  I think it would be most useful to direct the CSS parser's logging to a discrete logging channel that's not output to logcat but would show up in unit tests and in secret debug mode/its successor.  I'm going to punt on filing a bug on this for now since we don't have a need yet and there will be some churn as we overhaul back-end logging/secret debug mode a bit.

Yes, those look like Gecko CSS warnings.  I suppose if we ever see those it's probably an indication that our sanitizer could do a better job since something Gecko throws away at display time is just wasted storage space for us.
You need to log in before you can comment on or make changes to this bug.