Gecko:Obsolete API: Difference between revisions

m
Links; Updates
m (Links; Updates)
 
(17 intermediate revisions by 11 users not shown)
Line 3: Line 3:
If at all possible, please provide a) a suggested alternate class or function that provides similar functionality; and b) a link to a bug for removing the obsolete API from the codebase.  The bug should contain rationale for obsoleting that API.  To propose an API for obsolescence, please file a bug and add it to the proposed obsolete API section.
If at all possible, please provide a) a suggested alternate class or function that provides similar functionality; and b) a link to a bug for removing the obsolete API from the codebase.  The bug should contain rationale for obsoleting that API.  To propose an API for obsolescence, please file a bug and add it to the proposed obsolete API section.


= Obsolete API =
== Obsolete API ==
* nsIFileSpec, nsFileSpec
* nsIFileSpec, nsFileSpec
** FileSpec has various issues, including being limited to the system character set for filenames. <!-- more? -->
** FileSpec has various issues, including being limited to the system character set for filenames. <!-- more? -->
** Use nsIFile/nsILocalFile/nsILocalFile{In,Out}putStream
** Use nsIFile/nsILocalFile/nsILocalFile{In,Out}putStream
** https://bugzilla.mozilla.org/show_bug.cgi?id=38122
** {{Bug|38122}}
* nsIPref
* nsIPref ('''GONE''')
** Use nsIPrefService/nsIPrefBranch/nsIPrefBranch2
** Use nsIPrefService/nsIPrefBranch/nsIPrefBranch2
** https://bugzilla.mozilla.org/show_bug.cgi?id=175193
** {{Bug|175193}}
* ns(I)SupportsArray, nsIEnumerator
* ns(I)SupportsArray, nsIEnumerator
** nsSupportsArray is very inefficient and has a bad API
** nsSupportsArray is very inefficient and has a bad API
** Use any of the arrays in [http://www.mozilla.org/projects/xpcom/array-guide.html The Mozilla Array Guide], or use nsTArray (which is missing from the guide)
** Use any of the arrays in [[mdc:XPCOM_array_guide|The Mozilla Array Guide]].
** Mailnews Removal covered by {{bug|394167}}
* nsVoidArray
** Doesn't provide typesafety
** Prefer to use nsTArray or nsCOMArray.
* nsAutoVoidArray
** Use nsAutoTArray
* nsAutoBuffer
** Use nsAutoTArray
* nsStringArray, nsCStringArray
** Malloc-happy
** Use <nowiki>nsTArray<nsC?String></nowiki> if possible.
* nsHashtable
** Non-typesafe wrapper around pldhash.
** Use one of the hashtables in [[mdc:XPCOM_hashtable_guide|The Mozilla Hashtable Guide]]
* nsIBox
** This is now just a typedef for nsIFrame.
* nsIDOMEventReceiver ({{Bug|363089}}, and all specialized DOM event listener interfaces (better to use nsIDOMEventListener), e.g:
** nsIDOMCompositionListener
** nsIDOMContextMenuListener
** nsIDOMDragListener
** nsIDOMFocusListener
** nsIDOMFormListener
** nsIDOMKeyListener
** nsIDOMLoadListener
** nsIDOMMouseListener
** nsIDOMMouseMotionListener
** nsIDOMMutationListener (unused, remove in 1.9?, {{Bug|360847}})
** nsIDOMPageTransitionListener (unused, remove in 1.9?, {{Bug|360847}})
** nsIDOMPaintListener (unused, remove in 1.9?, {{Bug|360847}})
** nsIDOMScrollListener (unused, remove in 1.9?, {{Bug|360847}})
** nsIDOMTextListener
** nsIDOMUIListener
** nsIDOMXULListener


= Proposed Obsolete API =
== Proposed Obsolete API ==


* NS_GET_IID() and T::GetIID, except when NS_GET_IID is used on a template parameter.
* NS_GET_IID, NS_DEFINE_IID, and T::GetIID, except when NS_GET_IID is used on a template parameter.
** Instead, use function templates (like CallQueryInterface) or nsCOMPtr_helpers (like do_QueryInterface) to tie the XPCOM and C++ type systems together rather than casting between the two type systems.
** Instead, use function templates (like CallQueryInterface) or nsCOMPtr_helpers (like do_QueryInterface) to tie the XPCOM and C++ type systems together rather than casting between the two type systems.
* nsA[C]String
* nsA[C]String
** use ns[C]Substring when nsA[C]String is not required by existing APIs (although it is still required by XPCOM interfaces)
** use ns[C]Substring when nsA[C]String is not required by existing APIs (although it is still required by XPCOM interfaces)
* NS_NewAtom, NS_NewPermanentAtom
** use do_GetAtom, do_GetPermanentAtom instead
* nsIRenderingContext, nsIDrawingSurface, nsIFontMetrics, nsTransform2D, nsFont, etc. (see [[Gfx glue layer removal]].)
** any substantial new rendering code should be written to Thebes directly; that is, gfxContext, gfx*Surface, gfxPlatform, gfxFontGroup, gfxTextRun.
Confirmed users
97

edits