Last Comment Bug 334288 - use early returns in nsObjectLoadingContent::IsSupportedDocument
: use early returns in nsObjectLoadingContent::IsSupportedDocument
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Plug-ins (show other bugs)
: Trunk
: All All
: -- enhancement (vote)
: mozilla17
Assigned To: John Schoenick [:johns]
:
Mentors:
http://bonsai.mozilla.org/cvsblame.cg...
Depends on: 745030
Blocks:
  Show dependency treegraph
 
Reported: 2006-04-16 18:43 PDT by timeless
Modified: 2012-08-09 19:56 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
use early returns (2.34 KB, patch)
2006-04-17 00:48 PDT, timeless
bzbarsky: superreview-
Details | Diff | Review
Use early returns in nsObjectLoadingContent::IsSupportedDocument (2.98 KB, patch)
2012-08-08 14:15 PDT, John Schoenick [:johns]
no flags Details | Diff | Review
Use early returns in nsObjectLoadingContent::IsSupportedDocument (3.04 KB, patch)
2012-08-08 15:39 PDT, John Schoenick [:johns]
bzbarsky: review+
Details | Diff | Review

Description timeless 2006-04-16 18:43:53 PDT
coverity doesn't like this code, but it's wrong in claiming that it's dangerous.

i don't like this code either, so this bug is a request for:

if (!info)
  return PR_FALSE;

it simplifies the code and happens to quiet coverity (which complains that supported is used uninitialized - in the impossible case of do_GetService setting info to null and rv to ns_ok).
Comment 1 timeless 2006-04-17 00:48:16 PDT
Created attachment 218659 [details] [diff] [review]
use early returns
Comment 2 Boris Zbarsky [:bz] 2006-04-17 08:35:00 PDT
Comment on attachment 218659 [details] [diff] [review]
use early returns

Single-line ifs should be braced in this code.

Also, I'd like to see both the -w diff and a normal one.
Comment 3 Christian :Biesinger (don't email me, ping me on IRC) 2006-04-17 14:17:40 PDT
Comment on attachment 218659 [details] [diff] [review]
use early returns

what bz said
Comment 4 John Schoenick [:johns] 2012-08-08 14:15:13 PDT
Created attachment 650304 [details] [diff] [review]
Use early returns in nsObjectLoadingContent::IsSupportedDocument
Comment 5 John Schoenick [:johns] 2012-08-08 14:16:29 PDT
Comment on attachment 650304 [details] [diff] [review]
Use early returns in nsObjectLoadingContent::IsSupportedDocument

Resurrecting from the grave!
Comment 6 John Schoenick [:johns] 2012-08-08 15:39:55 PDT
Created attachment 650344 [details] [diff] [review]
Use early returns in nsObjectLoadingContent::IsSupportedDocument

Maybe a version that compiles would be preferable
Comment 7 Boris Zbarsky [:bz] 2012-08-08 16:10:46 PDT
Comment on attachment 650344 [details] [diff] [review]
Use early returns in nsObjectLoadingContent::IsSupportedDocument

r=me
Comment 8 John Schoenick [:johns] 2012-08-09 14:02:13 PDT
Survived a try push here:
https://tbpl.mozilla.org/?tree=Try&rev=02f602af452c

Landed on m-i:
http://hg.mozilla.org/integration/mozilla-inbound/rev/08631f0a9b1d
Comment 9 Ryan VanderMeulen [:RyanVM] 2012-08-09 19:56:30 PDT
https://hg.mozilla.org/mozilla-central/rev/08631f0a9b1d

Note You need to log in before you can comment on or make changes to this bug.