Persona is no longer an option for authentication on BMO. For more details see Persona Deprecated.
Last Comment Bug 406336 - nsIArray documentation (IndexOf, enumerate) is wrong.
: nsIArray documentation (IndexOf, enumerate) is wrong.
: dev-doc-complete
Product: Core
Classification: Components
Component: XPCOM (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla13
Assigned To: :aceman
: Nathan Froyd [:froydnj]
Depends on:
  Show dependency treegraph
Reported: 2007-12-01 10:44 PST by Mark Banner (:standard8)
Modified: 2012-02-22 16:01 PST (History)
3 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch for nsIArray.idl (1.32 KB, patch)
2012-02-17 14:07 PST, :aceman
benjamin: review+
Details | Diff | Splinter Review

Description Mark Banner (:standard8) 2007-12-01 10:44:46 PST
nsIArray is a frozen interface, but its documentation is wrong:

indexOf() states that it:
@throws NS_ERROR_NOT_FOUND if the element was not in the array.

That's incorrect, it throws NS_ERROR_FAILURE:,96#81

enumerate() also states that it:
@throws NS_ERROR_FAILURE if the array is empty (to make it easy to detect errors)

If you follow it through to NS_NewArrayEnumerator (, you'll find that empty arrays are allowed. You may get NS_ERROR_OUT_OF_MEMORY thrown if we're out of memory of course...

So, should we fix the documentation, or the code?

In the IndexOf case NS_ERROR_NOT_FOUND isn't currently a provided error code, and the enumerate case I think it should just accept it as otherwise we're changing the functionality that folks may be relying on.
Comment 1 Kent James (:rkent) 2011-08-05 11:17:16 PDT
I just got caught by this.

"So, should we fix the documentation, or the code?"

Easier just to change the documentation.
Comment 2 :aceman 2012-02-17 14:00:17 PST
I'll fix the docs, as there is no NS_ERROR_NOT_FOUND defined in .
Comment 3 :aceman 2012-02-17 14:07:41 PST
Created attachment 598369 [details] [diff] [review]
patch for nsIArray.idl

Also patch the comments in code.
Comment 4 :aceman 2012-02-17 14:20:37 PST
Somebody also needs to update . I had an account there but now it does not work due to BrowserID.
Comment 5 :aceman 2012-02-21 11:28:30 PST
I could now finally login into MDN so I fixed the docs too.
Comment 7 Ed Morley [:emorley] 2012-02-22 16:01:30 PST

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