summaryrefslogtreecommitdiffstats
path: root/mailnews
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-10 23:06:51 -0500
committerMatt A. Tobin <email@mattatobin.com>2019-11-10 23:06:51 -0500
commit66c5b11050b8aee2b467b896173279f3a35cdc3a (patch)
treee8410db8984f6070f08c525fd365de1ea5fdcd1b /mailnews
parentc5a0af05260c22ee72cef8e51d358fe8e8fda850 (diff)
downloadUXP-66c5b11050b8aee2b467b896173279f3a35cdc3a.tar
UXP-66c5b11050b8aee2b467b896173279f3a35cdc3a.tar.gz
UXP-66c5b11050b8aee2b467b896173279f3a35cdc3a.tar.lz
UXP-66c5b11050b8aee2b467b896173279f3a35cdc3a.tar.xz
UXP-66c5b11050b8aee2b467b896173279f3a35cdc3a.zip
Bugs 1512557 and 1470716 - Convert nsIStringBundle pointers to nsCOMPtrs and release them when shutting down.
Tag #1273
Diffstat (limited to 'mailnews')
-rw-r--r--mailnews/build/nsMailModule.cpp2
-rw-r--r--mailnews/intl/nsCharsetConverterManager.cpp24
-rw-r--r--mailnews/intl/nsCharsetConverterManager.h5
3 files changed, 10 insertions, 21 deletions
diff --git a/mailnews/build/nsMailModule.cpp b/mailnews/build/nsMailModule.cpp
index 285a0dfc9..5b86b4c3e 100644
--- a/mailnews/build/nsMailModule.cpp
+++ b/mailnews/build/nsMailModule.cpp
@@ -1366,8 +1366,6 @@ static const mozilla::Module::CategoryEntry kMailNewsCategories[] = {
// Mail View Entries
// mdn Entries
// i18n Entries
- { NS_TITLE_BUNDLE_CATEGORY, "chrome://messenger/locale/charsetTitles.properties", "" },
- { NS_DATA_BUNDLE_CATEGORY, "resource://gre-resources/charsetData.properties", "" },
NS_UCONV_REG_UNREG("UTF-7", NS_UTF7TOUNICODE_CID, NS_UNICODETOUTF7_CID)
NS_UCONV_REG_UNREG("x-imap4-modified-utf7", NS_MUTF7TOUNICODE_CID, NS_UNICODETOMUTF7_CID)
// Tokenizer Entries
diff --git a/mailnews/intl/nsCharsetConverterManager.cpp b/mailnews/intl/nsCharsetConverterManager.cpp
index e434ecd41..3d668fbf1 100644
--- a/mailnews/intl/nsCharsetConverterManager.cpp
+++ b/mailnews/intl/nsCharsetConverterManager.cpp
@@ -22,8 +22,8 @@
// just for CONTRACTIDs
#include "nsCharsetConverterManager.h"
-static nsIStringBundle * sDataBundle;
-static nsIStringBundle * sTitleBundle;
+static nsCOMPtr<nsIStringBundle> sDataBundle;
+static nsCOMPtr<nsIStringBundle> sTitleBundle;
// Class nsCharsetConverterManager [implementation]
@@ -35,25 +35,19 @@ nsCharsetConverterManager::nsCharsetConverterManager()
nsCharsetConverterManager::~nsCharsetConverterManager()
{
-}
-
-//static
-void nsCharsetConverterManager::Shutdown()
-{
- NS_IF_RELEASE(sDataBundle);
- NS_IF_RELEASE(sTitleBundle);
+ sDataBundle = nullptr;
+ sTitleBundle = nullptr;
}
static
-nsresult LoadExtensibleBundle(const char* aCategory,
- nsIStringBundle ** aResult)
+nsresult LoadBundle(const char* aBundleURLSpec, nsIStringBundle ** aResult)
{
nsCOMPtr<nsIStringBundleService> sbServ =
mozilla::services::GetStringBundleService();
if (!sbServ)
return NS_ERROR_FAILURE;
- return sbServ->CreateExtensibleBundle(aCategory, aResult);
+ return sbServ->CreateBundle(aBundleURLSpec, aResult);
}
static
@@ -97,7 +91,8 @@ nsresult GetCharsetDataImpl(const char * aCharset, const char16_t * aProp,
// aProp can be nullptr
if (!sDataBundle) {
- nsresult rv = LoadExtensibleBundle(NS_DATA_BUNDLE_CATEGORY, &sDataBundle);
+ nsresult rv = LoadBundle("resource://gre-resources/charsetData.properties",
+ getter_AddRefs(sDataBundle));
if (NS_FAILED(rv))
return rv;
}
@@ -306,7 +301,8 @@ nsCharsetConverterManager::GetCharsetTitle(const char * aCharset,
NS_ENSURE_ARG_POINTER(aCharset);
if (!sTitleBundle) {
- nsresult rv = LoadExtensibleBundle(NS_TITLE_BUNDLE_CATEGORY, &sTitleBundle);
+ nsresult rv = LoadBundle("chrome://messenger/locale/charsetTitles.properties",
+ getter_AddRefs(sTitleBundle));
NS_ENSURE_SUCCESS(rv, rv);
}
diff --git a/mailnews/intl/nsCharsetConverterManager.h b/mailnews/intl/nsCharsetConverterManager.h
index 9d00542b2..36a4bdddb 100644
--- a/mailnews/intl/nsCharsetConverterManager.h
+++ b/mailnews/intl/nsCharsetConverterManager.h
@@ -7,9 +7,6 @@
#include "nsICharsetConverterManager.h"
-#define NS_DATA_BUNDLE_CATEGORY "uconv-charset-data"
-#define NS_TITLE_BUNDLE_CATEGORY "uconv-charset-titles"
-
class nsCharsetAlias;
class nsCharsetConverterManager : public nsICharsetConverterManager
@@ -22,8 +19,6 @@ class nsCharsetConverterManager : public nsICharsetConverterManager
public:
nsCharsetConverterManager();
- static void Shutdown();
-
private:
virtual ~nsCharsetConverterManager();