From cb2d3b3251dca2710772a757967ab153c544c34a Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Tue, 4 Mar 2014 09:49:40 -0800 Subject: [PATCH] Bug 978486 - Remove nsErrorService::mErrorStringBundleKeyMap. r=froydnj --- intl/strres/src/nsStringBundle.cpp | 18 +++--------------- xpcom/base/nsErrorService.cpp | 23 ----------------------- xpcom/base/nsErrorService.h | 1 - xpcom/base/nsIErrorService.idl | 21 +-------------------- 4 files changed, 4 insertions(+), 59 deletions(-) diff --git a/intl/strres/src/nsStringBundle.cpp b/intl/strres/src/nsStringBundle.cpp index 3adb7a97da47..c484eff0fe85 100644 --- a/intl/strres/src/nsStringBundle.cpp +++ b/intl/strres/src/nsStringBundle.cpp @@ -718,21 +718,9 @@ nsStringBundleService::FormatWithBundle(nsIStringBundle* bundle, nsresult aStatu nsresult rv; nsXPIDLCString key; - // then find a key into the string bundle for that particular error: - rv = mErrorService->GetErrorStringBundleKey(aStatus, getter_Copies(key)); - - // first try looking up the error message with the string key: - if (NS_SUCCEEDED(rv)) { - rv = bundle->FormatStringFromName(NS_ConvertASCIItoUTF16(key).get(), - (const char16_t**)argArray, - argCount, result); - } - - // if the string key fails, try looking up the error message with the int key: - if (NS_FAILED(rv)) { - uint16_t code = NS_ERROR_GET_CODE(aStatus); - rv = bundle->FormatStringFromID(code, (const char16_t**)argArray, argCount, result); - } + // try looking up the error message with the int key: + uint16_t code = NS_ERROR_GET_CODE(aStatus); + rv = bundle->FormatStringFromID(code, (const char16_t**)argArray, argCount, result); // If the int key fails, try looking up the default error message. E.g. print: // An unknown error has occurred (0x804B0003). diff --git a/xpcom/base/nsErrorService.cpp b/xpcom/base/nsErrorService.cpp index 58ef07b817fc..85dd7a280a8f 100644 --- a/xpcom/base/nsErrorService.cpp +++ b/xpcom/base/nsErrorService.cpp @@ -93,27 +93,4 @@ nsErrorService::GetErrorStringBundle(int16_t errorModule, char **result) return NS_OK; } -NS_IMETHODIMP -nsErrorService::RegisterErrorStringBundleKey(nsresult error, const char *stringBundleKey) -{ - return mErrorStringBundleKeyMap.Put(static_cast(error), - stringBundleKey); -} - -NS_IMETHODIMP -nsErrorService::UnregisterErrorStringBundleKey(nsresult error) -{ - return mErrorStringBundleKeyMap.Remove(static_cast(error)); -} - -NS_IMETHODIMP -nsErrorService::GetErrorStringBundleKey(nsresult error, char **result) -{ - char* value = mErrorStringBundleKeyMap.Get(static_cast(error)); - if (value == nullptr) - return NS_ERROR_OUT_OF_MEMORY; - *result = value; - return NS_OK; -} - //////////////////////////////////////////////////////////////////////////////// diff --git a/xpcom/base/nsErrorService.h b/xpcom/base/nsErrorService.h index 2ea9758061de..b005b9426087 100644 --- a/xpcom/base/nsErrorService.h +++ b/xpcom/base/nsErrorService.h @@ -40,7 +40,6 @@ private: protected: nsInt2StrHashtable mErrorStringBundleURLMap; - nsInt2StrHashtable mErrorStringBundleKeyMap; }; #endif // nsErrorService_h__ diff --git a/xpcom/base/nsIErrorService.idl b/xpcom/base/nsIErrorService.idl index 7168c41c5898..9eeea2382f47 100644 --- a/xpcom/base/nsIErrorService.idl +++ b/xpcom/base/nsIErrorService.idl @@ -13,7 +13,7 @@ * This service will eventually get replaced by extending xpidl to allow errors to be defined. * (http://bugzilla.mozilla.org/show_bug.cgi?id=13423). */ -[scriptable, uuid(e72f94b2-5f85-11d4-9877-00c04fa0cf4a)] +[scriptable, uuid(afe1f190-a3c2-11e3-a5e2-0800200c9a66)] interface nsIErrorService : nsISupports { /** @@ -31,25 +31,6 @@ interface nsIErrorService : nsISupports * Retrieves a string bundle URL for an error module. */ string getErrorStringBundle(in short errorModule); - - /** - * Registers a key in a string bundle for an nsresult error code. Only the code portion - * of the nsresult is used (obtained with NS_ERROR_GET_CODE) in this registration. The - * string bundle key is used to look up internationalized messages in the string bundle. - */ - void registerErrorStringBundleKey(in nsresult error, in string stringBundleKey); - - /** - * Unregisters a key in a string bundle for an nsresult error code. - */ - void unregisterErrorStringBundleKey(in nsresult error); - - /** - * Retrieves a key in a string bundle for an nsresult error code. If no key is registered - * for the specified nsresult's code (obtained with NS_ERROR_GET_CODE), then the stringified - * version of the nsresult code is returned. - */ - string getErrorStringBundleKey(in nsresult error); }; %{C++