diff --git a/accessible/src/atk/nsAccessNodeWrap.cpp b/accessible/src/atk/nsAccessNodeWrap.cpp index f6460104457..ae998b79db3 100644 --- a/accessible/src/atk/nsAccessNodeWrap.cpp +++ b/accessible/src/atk/nsAccessNodeWrap.cpp @@ -67,7 +67,6 @@ nsAccessNodeWrap::~nsAccessNodeWrap() void nsAccessNodeWrap::InitAccessibility() { - nsAccessNode::InitXPAccessibility(); } void nsAccessNodeWrap::ShutdownAccessibility() diff --git a/accessible/src/base/nsAccessNode.cpp b/accessible/src/base/nsAccessNode.cpp index e908728748d..1e808b11455 100644 --- a/accessible/src/base/nsAccessNode.cpp +++ b/accessible/src/base/nsAccessNode.cpp @@ -51,7 +51,6 @@ #include "nsIInterfaceRequestorUtils.h" #include "nsIPresShell.h" #include "nsIServiceManager.h" -#include "nsIStringBundle.h" #include "nsFocusManager.h" #include "nsPresContext.h" #include "mozilla/Services.h" @@ -62,8 +61,6 @@ using namespace mozilla::a11y; * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html */ -nsIStringBundle *nsAccessNode::gStringBundle = 0; - ApplicationAccessible* nsAccessNode::gApplicationAccessible = nsnull; /* @@ -149,25 +146,12 @@ nsAccessNode::GetApplicationAccessible() return gApplicationAccessible; } -void nsAccessNode::InitXPAccessibility() -{ - nsCOMPtr stringBundleService = - mozilla::services::GetStringBundleService(); - if (stringBundleService) { - // Static variables are released in ShutdownAllXPAccessibility(); - stringBundleService->CreateBundle(ACCESSIBLE_BUNDLE_URL, - &gStringBundle); - } -} - void nsAccessNode::ShutdownXPAccessibility() { // Called by nsAccessibilityService::Shutdown() // which happens when xpcom is shutting down // at exit of program - NS_IF_RELEASE(gStringBundle); - // Release gApplicationAccessible after everything else is shutdown // so we don't accidently create it again while tearing down root accessibles ApplicationAccessibleWrap::Unload(); diff --git a/accessible/src/base/nsAccessNode.h b/accessible/src/base/nsAccessNode.h index fc05de4e266..e15b197baed 100644 --- a/accessible/src/base/nsAccessNode.h +++ b/accessible/src/base/nsAccessNode.h @@ -69,9 +69,6 @@ class nsPresContext; class nsIFrame; class nsIDocShellTreeItem; -#define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties" -#define PLATFORM_KEYS_BUNDLE_URL "chrome://global-platform/locale/platformKeys.properties" - class nsAccessNode: public nsISupports { public: @@ -79,11 +76,10 @@ public: nsAccessNode(nsIContent* aContent, nsDocAccessible* aDoc); virtual ~nsAccessNode(); - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_CLASS(nsAccessNode) + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_CLASS(nsAccessNode) - static void InitXPAccessibility(); - static void ShutdownXPAccessibility(); + static void ShutdownXPAccessibility(); /** * Return an application accessible. @@ -164,9 +160,6 @@ protected: nsCOMPtr mContent; nsDocAccessible* mDoc; - // Static data, we do our own refcounting for our static data. - static nsIStringBundle* gStringBundle; - private: nsAccessNode() MOZ_DELETE; nsAccessNode(const nsAccessNode&) MOZ_DELETE; diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index a051e989b74..aa9143bba69 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -82,6 +82,7 @@ #include "nsLayoutUtils.h" #include "nsIPresShell.h" +#include "nsIStringBundle.h" #include "nsPresContext.h" #include "nsIFrame.h" #include "nsIView.h" @@ -626,12 +627,24 @@ nsAccessible::GetIndexInParent(PRInt32 *aIndexInParent) } void -nsAccessible::TranslateString(const nsAString& aKey, nsAString& aStringOut) +nsAccessible::TranslateString(const nsString& aKey, nsAString& aStringOut) { - nsXPIDLString xsValue; + nsCOMPtr stringBundleService = + services::GetStringBundleService(); + if (!stringBundleService) + return; - gStringBundle->GetStringFromName(PromiseFlatString(aKey).get(), getter_Copies(xsValue)); - aStringOut.Assign(xsValue); + nsCOMPtr stringBundle; + stringBundleService->CreateBundle( + "chrome://global-platform/locale/accessible.properties", + getter_AddRefs(stringBundle)); + if (!stringBundle) + return; + + nsXPIDLString xsValue; + nsresult rv = stringBundle->GetStringFromName(aKey.get(), getter_Copies(xsValue)); + if (NS_SUCCEEDED(rv)) + aStringOut.Assign(xsValue); } PRUint64 @@ -3293,8 +3306,9 @@ KeyBinding::ToPlatformFormat(nsAString& aValue) const nsCOMPtr stringBundleService = mozilla::services::GetStringBundleService(); if (stringBundleService) - stringBundleService->CreateBundle(PLATFORM_KEYS_BUNDLE_URL, - getter_AddRefs(keyStringBundle)); + stringBundleService->CreateBundle( + "chrome://global-platform/locale/platformKeys.properties", + getter_AddRefs(keyStringBundle)); if (!keyStringBundle) return; diff --git a/accessible/src/base/nsAccessible.h b/accessible/src/base/nsAccessible.h index de6144c15ba..11b6746ce16 100644 --- a/accessible/src/base/nsAccessible.h +++ b/accessible/src/base/nsAccessible.h @@ -662,7 +662,7 @@ public: /** * Return the localized string for the given key. */ - static void TranslateString(const nsAString& aKey, nsAString& aStringOut); + static void TranslateString(const nsString& aKey, nsAString& aStringOut); /** * Return true if the accessible is defunct. diff --git a/accessible/src/mac/nsAccessNodeWrap.mm b/accessible/src/mac/nsAccessNodeWrap.mm index 084ac925333..c49bf7ac170 100644 --- a/accessible/src/mac/nsAccessNodeWrap.mm +++ b/accessible/src/mac/nsAccessNodeWrap.mm @@ -67,7 +67,6 @@ nsAccessNodeWrap::~nsAccessNodeWrap() void nsAccessNodeWrap::InitAccessibility() { - nsAccessNode::InitXPAccessibility(); } void nsAccessNodeWrap::ShutdownAccessibility() diff --git a/accessible/src/msaa/nsAccessNodeWrap.cpp b/accessible/src/msaa/nsAccessNodeWrap.cpp index 88468218111..8482215f486 100644 --- a/accessible/src/msaa/nsAccessNodeWrap.cpp +++ b/accessible/src/msaa/nsAccessNodeWrap.cpp @@ -588,8 +588,6 @@ void nsAccessNodeWrap::InitAccessibility() Compatibility::Init(); nsWinUtils::MaybeStartWindowEmulation(); - - nsAccessNode::InitXPAccessibility(); } void nsAccessNodeWrap::ShutdownAccessibility() diff --git a/accessible/src/other/nsAccessNodeWrap.cpp b/accessible/src/other/nsAccessNodeWrap.cpp index 1eb3632ca73..063ededb2ee 100644 --- a/accessible/src/other/nsAccessNodeWrap.cpp +++ b/accessible/src/other/nsAccessNodeWrap.cpp @@ -66,7 +66,6 @@ nsAccessNodeWrap::~nsAccessNodeWrap() void nsAccessNodeWrap::InitAccessibility() { - nsAccessNode::InitXPAccessibility(); } void nsAccessNodeWrap::ShutdownAccessibility()