diff --git a/mozilla/xpcom/ds/nsIStringService.idl b/mozilla/xpcom/ds/nsIStringService.idl index 0acb4bee1c0..5eae7e52043 100644 --- a/mozilla/xpcom/ds/nsIStringService.idl +++ b/mozilla/xpcom/ds/nsIStringService.idl @@ -51,6 +51,8 @@ interface nsIStringService : nsISupports { /** * Creates an nsAString from a |PRUnichar| buffer and length. + * + * Must be destroyed by deleteAString(); * * @param aString : A unicode string assigned to the new nsAString * @param aLength : The length of the string to be assigned to the new @@ -62,6 +64,8 @@ interface nsIStringService : nsISupports /** * Creates an nsAString from a |char| buffer and lenth. * + * Must be destroyed by deleteACString(); + * * @param aString : A string assigned to the new nsACString * @param aLength : The length of the string to be assigned to the new * nsACString @@ -69,6 +73,24 @@ interface nsIStringService : nsISupports nsACString createACString(in string aString, in long aLength); + + + /** + * Frees memory associated with the |nsAString|. After calling this method, + * the |aString| is no longer valid. + * + * @param aString : The |nsAString| object. + */ + void deleteAString(in nsAString aString); + + /** + * Frees memory associated with the |nsACString|. After calling this method, + * the |aString| is no longer valid. + * + * @param aString : The |nsACString| object. + */ + void deleteACString(in nsACString aString); + /** * Returns a new |PRUnichar| buffer containing the bytes of |aString|. This new * buffer may contain embedded null characters. The length of this new buffer diff --git a/mozilla/xpcom/ds/nsStringService.cpp b/mozilla/xpcom/ds/nsStringService.cpp index 176b82614ef..b40a546acac 100644 --- a/mozilla/xpcom/ds/nsStringService.cpp +++ b/mozilla/xpcom/ds/nsStringService.cpp @@ -78,6 +78,34 @@ nsStringService::CreateACString(const char *aString, PRInt32 aLength, nsACString return NS_OK; } +NS_IMETHODIMP +nsStringService::DeleteAString(nsAString * aString) +{ + delete aString; + return NS_OK; +} + +NS_IMETHODIMP +nsStringService::DeleteACString(nsACString * aString) +{ + delete aString; + return NS_OK; +} + +NS_IMETHODIMP +nsStringService::DeleteAString(nsAString * aString) +{ + delete aString; + return NS_OK; +} + +NS_IMETHODIMP +nsStringService::DeleteACString(nsACString * aString) +{ + delete aString; + return NS_OK; +} + NS_IMETHODIMP nsStringService::GetString(const nsACString & aString, char **_retval) {