Closed Bug 48783 Opened 26 years ago Closed 24 years ago

nsSupportsArray's nsICollection implementation breaks XPCOM rules.

Categories

(Core :: XPCOM, defect, P3)

x86
Windows 98
defect

Tracking

()

RESOLVED WONTFIX
Future

People

(Reporter: jud, Assigned: dougt)

Details

(Keywords: helpwanted, topembed-, Whiteboard: [nsbeta3-])

nsSupportsArray says it implements nsISupportsArray (which inherits from nsICollection). nsICollection says it's an xpcom iterface and returns an nsresult for AppendElement (and RemoveElement). However, nsSupportsArray's implementation of nsICollection is not returning valid nsresults (see http://lxr.mozilla.org/seamonkey/source/xpcom/ds/nsSupportsArray.h#58). Instead it's returning the opposite of what it should be returning (it's returning a bool which is reversed in com). If you checked the retval of AppendElement for NS_OK you'd fail, even though AppendElement succeeded.
When this is fixed, the following needs to be changed accordingly: http://lxr.mozilla.org/seamonkey/source/xpcom/io/nsDirectoryService.cpp#626
Ray owns all this now.
Assignee: dp → rayw
It would be helpful if the reporter knows of a simple test that could be used to verify the fix.
It's an API problem. It's defined to be returning 0 when it should be returning 1 and vice versa. To test it, just call the method and see if you get the right result. The change is a one-line change to the method (see the method above it), but callers may need to be updated as well.
I asked the question, because it seemed that this information would be quite obvious to whoever filed the bug report who understood the codependance and that the original function was working, and would make a silly mistake less likely. It is not a one-line change. The corresponding change also needs to be made to the code which calls it. The change is easy, but could also be screwed up by misinterpreting a compiler interpretation. The question is, what observable function of Netscape fails if these co-dependent changes are incorrectly done at some level. Or I will spend a while figuring it out myself so I can reasonably test. I just thought that the person who understood the problem in its original context could save me a few minutes, but it is taking way too much time to explain a simple request for basic bug information about how to test the bug and the fix. Especially with codependent changes, it is usually best to test them together and know what behavior of Netscape could be compromised.
I know this is a dup, but I can't find the original. And yeah, this API problem is heinous -- I often forget that AppendElement/RemoveElement (and friends) return the wrong thing, and find out later when it fails.
The word "often" leads me to believe that there are a number of places to be fixed. I will hunt for them.
I have made this nsbeta3+, because it seems that this is a critical API change that cannot wait until later.
Keywords: nsbeta3
Whiteboard: [nsbeta3+]
Status: NEW → ASSIGNED
Target Milestone: --- → M18
Adding verifyme keyword.
Keywords: verifyme
QA Contact: leger → rayw
nsbeta3-
Whiteboard: [nsbeta3+] → [nsbeta3-]
Assigning rest of xpcom stuff to myself (from Ray).
Assignee: rayw → warren
Status: ASSIGNED → NEW
Target Milestone: M18 → mozilla1.0
reasigning warren bugs to default component owners.
Assignee: warren → kandrot
QA Contact: rayw → scc
Target Milestone: mozilla1.0 → ---
reassign all kandrot xpcom bug.
Assignee: kandrot → dougt
Blocks: 98278
this interface is not going to be exposed.
Keywords: nsbeta3, verifyme → helpwanted
Target Milestone: --- → Future
Keywords: topembed
This is not part of the XPCOM SDK and therefore should not be a top embed bug.
No longer blocks: 98278
Keywords: topembed → topembed-
Dup of bug 130544?
wont fix
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.