All users were logged out of Bugzilla on October 13th, 2018

Unreachable statement (duplicate return) in nsXULAttribute and nsSVGAttributes (Bugs found via linting....)

RESOLVED FIXED in mozilla1.1beta

Status

()

P3
normal
RESOLVED FIXED
17 years ago
10 years ago

People

(Reporter: cyent, Assigned: timwatt)

Tracking

Trunk
mozilla1.1beta
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(2 attachments, 1 obsolete attachment)

(Reporter)

Description

17 years ago
This is a list of bugs found by antic (http://artho.com/jlint/)

The vast majority of false positives have been removed leaving only
definite bugs and highly suspicious cases.

======================================================================
Same one as in svg
The "return NS_OK" is unreachable, probably a bug.

~/builds/mozilla/content/xul/content/src/nsXULAttributes.cpp:600:9: Unreachable
statement

nsXULAttributes::RemoveNamedItem(const nsAReadableString& aName,
                                 nsIDOMNode** aReturn)
{
    nsCOMPtr<nsIDOMElement> element( do_QueryInterface(mContent) );
    if (element) {
        return element->RemoveAttribute(aName);
        *aReturn = nsnull; // XXX should be the element we just removed
        return NS_OK;
    }
    else {
        return NS_ERROR_FAILURE;
    }
}
That would be "XP Toolkit/Widgets: XUL".
Assignee: asa → hyatt
Component: Browser-General → XP Toolkit/Widgets: XUL
QA Contact: doronr → shrir

Comment 2

17 years ago
cvsblame sez waterson.

bbaetz, this was also copy-pasted into SVG: nsSVGAttributes.cpp, line 931.
Assignee: hyatt → waterson
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Which component is XUL? Bugs found via linting.... → Unreachable statement (duplicate return) in nsXULAttribute and nsSVGAttributes (Bugs found via linting....)
SVG case is bug 133710; feel free to fix both of these at the same time.

Comment 4

17 years ago
*** Bug 133710 has been marked as a duplicate of this bug. ***

Comment 5

17 years ago
Created attachment 76529 [details] [diff] [review]
patch fixing ns{XUL,SVG}Attributes

Comment 6

17 years ago
How embarrassing. While we're at it, maybe we should remove the
else-after-return, too?

Updated

17 years ago
Status: NEW → ASSIGNED
Keywords: patch

Updated

17 years ago
Priority: -- → P3
Target Milestone: --- → mozilla1.0.1
Target Milestone: mozilla1.0.1 → mozilla1.1beta
(Assignee)

Comment 7

17 years ago
Created attachment 92147 [details] [diff] [review]
The previous patch without the else-after-return

Updated

17 years ago
Attachment #92147 - Flags: review+

Comment 8

17 years ago
Jul 11 15:43 Out with the old, in with the new.
Assignee: waterson → bzbarsky
Status: ASSIGNED → NEW
Comment on attachment 92147 [details] [diff] [review]
The previous patch without the else-after-return

This leaves aReturn un-initialized.  Unacceptable (even if equivalent to the
exisiting code).
Attachment #92147 - Flags: needs-work+
This is not mine; please mail me when you need review instead of assigning bugs
to me.  To patch author, to fix the patch.  ;)
Assignee: bzbarsky → riceman+bmo
(Assignee)

Comment 11

17 years ago
Created attachment 92193 [details] [diff] [review]
Initialize out param, too

I also pre-emptively fixed the grammar of the comment, just to avoid another
round =)
Attachment #92147 - Attachment is obsolete: true
Comment on attachment 92193 [details] [diff] [review]
Initialize out param, too

sr=bzbarsky; please file bugs on fixing those aReturn values if there aren't
such bugs already.
Attachment #92193 - Flags: superreview+

Updated

16 years ago
Attachment #92193 - Flags: review+

Updated

16 years ago
Blocks: 158627
(Assignee)

Comment 13

16 years ago
This has had R+SR for a while. Has it bitrotted yet? I don't have a tree handy
(or the capacity for a tree on this machine). I can check its status in a week
or so.  If it hasn't bitrotted (miraculously), is there something holding it
from being checked in?
This has not bitrotted, and even builds.  I'll try to check it in early next
week, but if someone has time before then that would be great.
03/04/2003 18:35	timeless%mozdev.org 	mozilla/ content/ xul/ content/ src/
nsXULAttributes.cpp 	1.62 	3/5  	Bug 133711 Unreachable statement (duplicate
return) in nsXULAttribute and nsSVGAttributes (Bugs found via linting....)
patch by riceman+bmo@mail.rit.edu r=timeless sr=bz

therefore, marking FIXED.
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → FIXED

Updated

10 years ago
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: shrir → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.