Closed Bug 278200 Opened 20 years ago Closed 20 years ago

get rid of unnecessary warnings in nsIMIMEHeaderParameter::GetParameter (debug build)

Categories

(Core :: Networking: HTTP, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jshin1987, Assigned: jshin1987)

Details

Attachments

(1 file)

|NS_ENSURE_SUCCESS(rv, rv)| keeps failing at netwerk/mime/src/
nsMIMEHeaderParamImpl.cpp:94 because it's invoked by the script loader for
Javascript version, but in most cases 'Content-Type' header for Javascript
doesn't have 'version' parameter. Therefore, nsIMIMEHeaderParameter->
GetParameter(..., 'version'...) fails most of time. 

We may as well change it to return zero-length string instead of returning the
failure code. 
It's also used heavily in mailnews so that we have to make sure changing it
doesn't break anything.
but GetParameter did fail. how would you differentiate an empty parameter from a
not present parameter?

why not change the caller to not use NS_ENSURE_SUCCESS for something which may
legitimately return a failure code?
Attached patch 1-linerSplinter Review
cbie, you're right. I should've used |if (NS_FAILED(rv)) return rv;| although
in optimized build, there's no difference.
Comment on attachment 171149 [details] [diff] [review]
1-liner

this looks good to me.	consumers of nsIMIMEHeaderParameter can NS_ENSURE_XXX
if they want, but since this function is used on unknown input it seems better
not to issue a warning on failure.

sr=darin
Attachment #171149 - Flags: superreview+
Comment on attachment 171149 [details] [diff] [review]
1-liner

When loading pages with several external javascript files, warnings from this
can be quite bothering. We'd better get rid of it because most of time, it's
not an error but a legitimate failure.
Attachment #171149 - Flags: superreview?(darin)
Attachment #171149 - Flags: review?(cbiesinger)
Comment on attachment 171149 [details] [diff] [review]
1-liner

thanks for sr.
crossed in 'mail'. clearing an extraneous sr request.
Attachment #171149 - Flags: superreview?(darin)
Attachment #171149 - Flags: review?(cbiesinger) → review+
landed in the trunk. (thanks for reviews)
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Summary: nsIMIMEHeaderParameter::GetParameter may as well return NULL(0-length) string when param is not present → get rid of unnecessary warnings in nsIMIMEHeaderParameter::GetParameter (debug build)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: