Closed Bug 253936 Opened 20 years ago Closed 20 years ago

incorrect use of assertions with UTF-8 checking

Categories

(MailNews Core :: MIME, defect)

defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: dmosedale, Assigned: jshin1987)

References

()

Details

Attachments

(1 file)

There are two problems with the assertions introduced in 213035: 

a) they assert if "line" is null with a message about UTF8-ness.  If line is
null, UTF8ness (or lack thereof) is not what's going on.  Note that the old code
did not assert in this case at all.

b) assertions have a specific meaning: they are supposed to indicate "if this
assertion is not true, there is a bug in the code".  However, in an MUA, having
to handle badly formatted mail messages is a completely normal use case.

Most importantly, though, they introduce unneccessary noise on the console when
looking for real code problems.  I believe they should go away.
(In reply to comment #0)
> There are two problems with the assertions introduced in 213035: 

  |NS_ASSERTION| was added in bug 213035, but assertions had been there long
before that. I just moved them. 
 
> a) they assert if "line" is null with a message about UTF8-ness.  If line is
> null, UTF8ness (or lack thereof) is not what's going on.  Note that the old code
> did not assert in this case at all.

You misread the code. It doesn't assert when line is null. It asserts only if
line is NOT null and line is not UTF8. The current code does exactly the same
except that it asserts where the "problem" is instead of nsReadableUtils.


> b) assertions have a specific meaning: they are supposed to indicate "if this
> assertion is not true, there is a bug in the code".  However, in an MUA, having
> to handle badly formatted mail messages is a completely normal use case.

 I shouldn't have blindly 'moved' assertions from nsReadableUtils to
nsMsgHeaderParser. 
 
> Most importantly, though, they introduce unneccessary noise on the console when
> looking for real code problems.  I believe they should go away.

 I agree and am gonna get rid of them. 
Status: NEW → ASSIGNED
Attached patch patchSplinter Review
Comment on attachment 155489 [details] [diff] [review]
patch

asking for r/sr
Attachment #155489 - Flags: superreview?(neil.parkwaycc.co.uk)
Attachment #155489 - Flags: review?(dmose)
Attachment #155489 - Flags: superreview?(neil.parkwaycc.co.uk) → superreview+
Comment on attachment 155489 [details] [diff] [review]
patch

r=dmose.  One question... is there anything better we could be doing in the
situation where somebody sends a message which contains bogus encodings of
characters, and thus would currently trigger these asserts?
Attachment #155489 - Flags: review?(dmose) → review+
Product: MailNews → Core
marking as fixed. it was checked in August. 

>is there anything better we could be doing in th
I think we're doing our best down the road and this assertion had been useless
for a long time
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: