mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Bugs 1512557 and 1470716 - Convert nsIStringBundle pointers to nsCOMPtrs and release them when shutting down.
Tag #1273
This commit is contained in:
parent
70d9e97b14
commit
1e792c1fee
3 changed files with 10 additions and 21 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue