diff --git a/xpcom/string/nsTString.h b/xpcom/string/nsTString.h index ab00a8f53045..584c553dca48 100644 --- a/xpcom/string/nsTString.h +++ b/xpcom/string/nsTString.h @@ -372,12 +372,14 @@ public: using nsTSubstring_CharT::StripChars; #endif void StripChars(const char* aSet); + bool StripChars(const char* aSet, const fallible_t&); /** * This method strips whitespace throughout the string. */ void StripWhitespace(); + bool StripWhitespace(const fallible_t&); /** diff --git a/xpcom/string/nsTStringObsolete.cpp b/xpcom/string/nsTStringObsolete.cpp index 461c4da1bf2b..edab84b02bba 100644 --- a/xpcom/string/nsTStringObsolete.cpp +++ b/xpcom/string/nsTStringObsolete.cpp @@ -407,12 +407,28 @@ nsTString_CharT::StripChars( const char* aSet ) mLength = nsBufferRoutines::strip_chars(mData, mLength, aSet); } +bool +nsTString_CharT::StripChars( const char* aSet, const fallible_t& ) +{ + if (!EnsureMutable()) { + return false; + } + + mLength = nsBufferRoutines::strip_chars(mData, mLength, aSet); + return true; +} + void nsTString_CharT::StripWhitespace() { StripChars(kWhitespace); } +bool +nsTString_CharT::StripWhitespace(const fallible_t& aFallible) +{ + return StripChars(kWhitespace, aFallible); +} /** * nsTString::ReplaceChar,ReplaceSubstring