diff --git a/mozilla/htmlparser/src/nsParserMsgUtils.cpp b/mozilla/htmlparser/src/nsParserMsgUtils.cpp
index 5ef5ad87bc2..13ad5842d21 100644
--- a/mozilla/htmlparser/src/nsParserMsgUtils.cpp
+++ b/mozilla/htmlparser/src/nsParserMsgUtils.cpp
@@ -21,8 +21,6 @@
*/
#include "nsIServiceManager.h"
-#include "nsIIOService.h"
-#include "nsIURI.h"
#include "nsIStringBundle.h"
#include "nsITextContent.h"
#include "nsISupportsArray.h"
@@ -30,7 +28,6 @@
#include "nsParserMsgUtils.h"
#include "nsNetCID.h"
-static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
// This code is derived from nsFormControlHelper::GetLocalizedString()
@@ -40,27 +37,14 @@ static nsresult GetBundle(const char * aPropFileName, nsIStringBundle **aBundle)
NS_ENSURE_ARG_POINTER(aPropFileName);
NS_ENSURE_ARG_POINTER(aBundle);
- // Create a URL for the string resource file
// Create a bundle for the localization
nsresult rv;
- nsCOMPtr pNetService(do_GetService(kIOServiceCID, &rv));
- if (NS_SUCCEEDED(rv)) {
- nsCOMPtr uri;
- rv = pNetService->NewURI(aPropFileName, nsnull, getter_AddRefs(uri));
- if (NS_SUCCEEDED(rv)) {
-
- // Create bundle
- nsCOMPtr stringService =
- do_GetService(kStringBundleServiceCID, &rv);
- if (NS_SUCCEEDED(rv)) {
- nsXPIDLCString spec;
- rv = uri->GetSpec(getter_Copies(spec));
- if (NS_SUCCEEDED(rv) && spec) {
- rv = stringService->CreateBundle(spec, aBundle);
- }
- }
- }
- }
+
+ nsCOMPtr stringService =
+ do_GetService(kStringBundleServiceCID, &rv);
+ if (NS_SUCCEEDED(rv))
+ rv = stringService->CreateBundle(aPropFileName, aBundle);
+
return rv;
}
diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp
index 56798d88eea..ef14f190627 100644
--- a/mozilla/layout/forms/nsFileControlFrame.cpp
+++ b/mozilla/layout/forms/nsFileControlFrame.cpp
@@ -285,7 +285,7 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
// Get Loc title
nsString title;
nsFormControlHelper::GetLocalizedString(nsFormControlHelper::GetHTMLPropertiesFileName(),
- "FileUpload", title);
+ NS_LITERAL_STRING("FileUpload").get(), title);
nsCOMPtr filePicker = do_CreateInstance("@mozilla.org/filepicker;1");
if (!filePicker)
diff --git a/mozilla/layout/forms/nsFormControlHelper.cpp b/mozilla/layout/forms/nsFormControlHelper.cpp
index 2b3519c6560..d1b62abf52d 100644
--- a/mozilla/layout/forms/nsFormControlHelper.cpp
+++ b/mozilla/layout/forms/nsFormControlHelper.cpp
@@ -57,14 +57,11 @@
// Needed for Localization
#include "nsIServiceManager.h"
-#include "nsIIOService.h"
-#include "nsIURI.h"
#include "nsIStringBundle.h"
#include "nsITextContent.h"
#include "nsISupportsArray.h"
#include "nsXPIDLString.h"
-static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
// done I10N
@@ -882,37 +879,24 @@ nsFormControlHelper::GetInputElementValue(nsIContent* aContent, nsString* aText,
// Return localised string for resource string (e.g. "Submit" -> "Submit Query")
// This code is derived from nsBookmarksService::Init() and cookie_Localize()
nsresult
-nsFormControlHelper::GetLocalizedString(const char * aPropFileName, const char* aKey, nsString& oVal)
+nsFormControlHelper::GetLocalizedString(const char * aPropFileName, const PRUnichar* aKey, nsString& oVal)
{
+ NS_ENSURE_ARG_POINTER(aKey);
+
nsresult rv;
+
nsCOMPtr bundle;
- // Create a URL for the string resource file
// Create a bundle for the localization
- nsCOMPtr pNetService(do_GetService(kIOServiceCID, &rv));
- if (NS_SUCCEEDED(rv) && pNetService) {
- nsCOMPtr uri;
- rv = pNetService->NewURI(aPropFileName, nsnull, getter_AddRefs(uri));
- if (NS_SUCCEEDED(rv) && uri) {
-
- // Create bundle
- nsCOMPtr stringService =
- do_GetService(kStringBundleServiceCID, &rv);
- if (NS_SUCCEEDED(rv) && stringService) {
- nsXPIDLCString spec;
- rv = uri->GetSpec(getter_Copies(spec));
- if (NS_SUCCEEDED(rv) && spec) {
- rv = stringService->CreateBundle(spec, getter_AddRefs(bundle));
- }
- }
- }
- }
+ nsCOMPtr stringService =
+ do_GetService(kStringBundleServiceCID, &rv);
+ if (NS_SUCCEEDED(rv) && stringService)
+ rv = stringService->CreateBundle(aPropFileName, getter_AddRefs(bundle));
// Determine default label from string bundle
- if (NS_SUCCEEDED(rv) && bundle && aKey) {
+ if (NS_SUCCEEDED(rv) && bundle) {
nsXPIDLString valUni;
- nsAutoString key; key.AssignWithConversion(aKey);
- rv = bundle->GetStringFromName(key.get(), getter_Copies(valUni));
+ rv = bundle->GetStringFromName(aKey, getter_Copies(valUni));
if (NS_SUCCEEDED(rv) && valUni) {
oVal.Assign(valUni);
} else {
diff --git a/mozilla/layout/forms/nsFormControlHelper.h b/mozilla/layout/forms/nsFormControlHelper.h
index dfc6eb69107..cfa66eb6187 100644
--- a/mozilla/layout/forms/nsFormControlHelper.h
+++ b/mozilla/layout/forms/nsFormControlHelper.h
@@ -178,7 +178,7 @@ public:
static nsresult GetWrapPropertyEnum(nsIContent * aContent, nsHTMLTextWrap& aWrapProp);
// Localization Helper
- static nsresult GetLocalizedString(const char * aPropFileName, const char* aKey, nsString& oVal);
+ static nsresult GetLocalizedString(const char * aPropFileName, const PRUnichar* aKey, nsString& oVal);
static const char * GetHTMLPropertiesFileName() { return FORM_PROPERTIES; }
static nsresult GetDisabled(nsIContent* aContent, PRBool* oIsDisabled);
diff --git a/mozilla/layout/forms/nsGfxButtonControlFrame.cpp b/mozilla/layout/forms/nsGfxButtonControlFrame.cpp
index 23ded4a89c3..b35a994ed63 100644
--- a/mozilla/layout/forms/nsGfxButtonControlFrame.cpp
+++ b/mozilla/layout/forms/nsGfxButtonControlFrame.cpp
@@ -534,16 +534,16 @@ nsGfxButtonControlFrame::GetDefaultLabel(nsString& aString)
PRInt32 type;
GetType(&type);
if (IsReset(type)) {
- rv = nsFormControlHelper::GetLocalizedString(propname, "Reset", aString);
+ rv = nsFormControlHelper::GetLocalizedString(propname, NS_LITERAL_STRING("Reset").get(), aString);
}
else if (IsSubmit(type)) {
- rv = nsFormControlHelper::GetLocalizedString(propname, "Submit", aString);
+ rv = nsFormControlHelper::GetLocalizedString(propname, NS_LITERAL_STRING("Submit").get(), aString);
}
else if (IsBrowse(type)) {
- rv = nsFormControlHelper::GetLocalizedString(propname, "Browse", aString);
+ rv = nsFormControlHelper::GetLocalizedString(propname, NS_LITERAL_STRING("Browse").get(), aString);
}
else {
- aString.AssignWithConversion(" ");
+ aString.Assign(NS_LITERAL_STRING(" "));
rv = NS_OK;
}
return rv;
diff --git a/mozilla/layout/forms/nsIsIndexFrame.cpp b/mozilla/layout/forms/nsIsIndexFrame.cpp
index f2c4265adee..e983a1f999a 100644
--- a/mozilla/layout/forms/nsIsIndexFrame.cpp
+++ b/mozilla/layout/forms/nsIsIndexFrame.cpp
@@ -146,7 +146,7 @@ nsIsIndexFrame::UpdatePromptLabel()
// because the value is localized for non-english platforms, thus
// it might not be the string "This is a searchable index. Enter search keywords: "
result = nsFormControlHelper::GetLocalizedString(nsFormControlHelper::GetHTMLPropertiesFileName(),
- "IsIndexPrompt", prompt);
+ NS_LITERAL_STRING("IsIndexPrompt").get(), prompt);
}
nsCOMPtr text = do_QueryInterface(mTextContent);
result = text->SetText(prompt.get(), prompt.Length(), PR_TRUE);
diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp
index 56798d88eea..ef14f190627 100644
--- a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp
+++ b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp
@@ -285,7 +285,7 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
// Get Loc title
nsString title;
nsFormControlHelper::GetLocalizedString(nsFormControlHelper::GetHTMLPropertiesFileName(),
- "FileUpload", title);
+ NS_LITERAL_STRING("FileUpload").get(), title);
nsCOMPtr filePicker = do_CreateInstance("@mozilla.org/filepicker;1");
if (!filePicker)
diff --git a/mozilla/layout/html/forms/src/nsFormControlHelper.cpp b/mozilla/layout/html/forms/src/nsFormControlHelper.cpp
index 2b3519c6560..d1b62abf52d 100644
--- a/mozilla/layout/html/forms/src/nsFormControlHelper.cpp
+++ b/mozilla/layout/html/forms/src/nsFormControlHelper.cpp
@@ -57,14 +57,11 @@
// Needed for Localization
#include "nsIServiceManager.h"
-#include "nsIIOService.h"
-#include "nsIURI.h"
#include "nsIStringBundle.h"
#include "nsITextContent.h"
#include "nsISupportsArray.h"
#include "nsXPIDLString.h"
-static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
// done I10N
@@ -882,37 +879,24 @@ nsFormControlHelper::GetInputElementValue(nsIContent* aContent, nsString* aText,
// Return localised string for resource string (e.g. "Submit" -> "Submit Query")
// This code is derived from nsBookmarksService::Init() and cookie_Localize()
nsresult
-nsFormControlHelper::GetLocalizedString(const char * aPropFileName, const char* aKey, nsString& oVal)
+nsFormControlHelper::GetLocalizedString(const char * aPropFileName, const PRUnichar* aKey, nsString& oVal)
{
+ NS_ENSURE_ARG_POINTER(aKey);
+
nsresult rv;
+
nsCOMPtr bundle;
- // Create a URL for the string resource file
// Create a bundle for the localization
- nsCOMPtr pNetService(do_GetService(kIOServiceCID, &rv));
- if (NS_SUCCEEDED(rv) && pNetService) {
- nsCOMPtr uri;
- rv = pNetService->NewURI(aPropFileName, nsnull, getter_AddRefs(uri));
- if (NS_SUCCEEDED(rv) && uri) {
-
- // Create bundle
- nsCOMPtr stringService =
- do_GetService(kStringBundleServiceCID, &rv);
- if (NS_SUCCEEDED(rv) && stringService) {
- nsXPIDLCString spec;
- rv = uri->GetSpec(getter_Copies(spec));
- if (NS_SUCCEEDED(rv) && spec) {
- rv = stringService->CreateBundle(spec, getter_AddRefs(bundle));
- }
- }
- }
- }
+ nsCOMPtr stringService =
+ do_GetService(kStringBundleServiceCID, &rv);
+ if (NS_SUCCEEDED(rv) && stringService)
+ rv = stringService->CreateBundle(aPropFileName, getter_AddRefs(bundle));
// Determine default label from string bundle
- if (NS_SUCCEEDED(rv) && bundle && aKey) {
+ if (NS_SUCCEEDED(rv) && bundle) {
nsXPIDLString valUni;
- nsAutoString key; key.AssignWithConversion(aKey);
- rv = bundle->GetStringFromName(key.get(), getter_Copies(valUni));
+ rv = bundle->GetStringFromName(aKey, getter_Copies(valUni));
if (NS_SUCCEEDED(rv) && valUni) {
oVal.Assign(valUni);
} else {
diff --git a/mozilla/layout/html/forms/src/nsFormControlHelper.h b/mozilla/layout/html/forms/src/nsFormControlHelper.h
index dfc6eb69107..cfa66eb6187 100644
--- a/mozilla/layout/html/forms/src/nsFormControlHelper.h
+++ b/mozilla/layout/html/forms/src/nsFormControlHelper.h
@@ -178,7 +178,7 @@ public:
static nsresult GetWrapPropertyEnum(nsIContent * aContent, nsHTMLTextWrap& aWrapProp);
// Localization Helper
- static nsresult GetLocalizedString(const char * aPropFileName, const char* aKey, nsString& oVal);
+ static nsresult GetLocalizedString(const char * aPropFileName, const PRUnichar* aKey, nsString& oVal);
static const char * GetHTMLPropertiesFileName() { return FORM_PROPERTIES; }
static nsresult GetDisabled(nsIContent* aContent, PRBool* oIsDisabled);
diff --git a/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp
index 23ded4a89c3..b35a994ed63 100644
--- a/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp
+++ b/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp
@@ -534,16 +534,16 @@ nsGfxButtonControlFrame::GetDefaultLabel(nsString& aString)
PRInt32 type;
GetType(&type);
if (IsReset(type)) {
- rv = nsFormControlHelper::GetLocalizedString(propname, "Reset", aString);
+ rv = nsFormControlHelper::GetLocalizedString(propname, NS_LITERAL_STRING("Reset").get(), aString);
}
else if (IsSubmit(type)) {
- rv = nsFormControlHelper::GetLocalizedString(propname, "Submit", aString);
+ rv = nsFormControlHelper::GetLocalizedString(propname, NS_LITERAL_STRING("Submit").get(), aString);
}
else if (IsBrowse(type)) {
- rv = nsFormControlHelper::GetLocalizedString(propname, "Browse", aString);
+ rv = nsFormControlHelper::GetLocalizedString(propname, NS_LITERAL_STRING("Browse").get(), aString);
}
else {
- aString.AssignWithConversion(" ");
+ aString.Assign(NS_LITERAL_STRING(" "));
rv = NS_OK;
}
return rv;
diff --git a/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp b/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp
index f2c4265adee..e983a1f999a 100644
--- a/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp
+++ b/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp
@@ -146,7 +146,7 @@ nsIsIndexFrame::UpdatePromptLabel()
// because the value is localized for non-english platforms, thus
// it might not be the string "This is a searchable index. Enter search keywords: "
result = nsFormControlHelper::GetLocalizedString(nsFormControlHelper::GetHTMLPropertiesFileName(),
- "IsIndexPrompt", prompt);
+ NS_LITERAL_STRING("IsIndexPrompt").get(), prompt);
}
nsCOMPtr text = do_QueryInterface(mTextContent);
result = text->SetText(prompt.get(), prompt.Length(), PR_TRUE);
diff --git a/mozilla/parser/htmlparser/src/nsParserMsgUtils.cpp b/mozilla/parser/htmlparser/src/nsParserMsgUtils.cpp
index 5ef5ad87bc2..13ad5842d21 100644
--- a/mozilla/parser/htmlparser/src/nsParserMsgUtils.cpp
+++ b/mozilla/parser/htmlparser/src/nsParserMsgUtils.cpp
@@ -21,8 +21,6 @@
*/
#include "nsIServiceManager.h"
-#include "nsIIOService.h"
-#include "nsIURI.h"
#include "nsIStringBundle.h"
#include "nsITextContent.h"
#include "nsISupportsArray.h"
@@ -30,7 +28,6 @@
#include "nsParserMsgUtils.h"
#include "nsNetCID.h"
-static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
// This code is derived from nsFormControlHelper::GetLocalizedString()
@@ -40,27 +37,14 @@ static nsresult GetBundle(const char * aPropFileName, nsIStringBundle **aBundle)
NS_ENSURE_ARG_POINTER(aPropFileName);
NS_ENSURE_ARG_POINTER(aBundle);
- // Create a URL for the string resource file
// Create a bundle for the localization
nsresult rv;
- nsCOMPtr pNetService(do_GetService(kIOServiceCID, &rv));
- if (NS_SUCCEEDED(rv)) {
- nsCOMPtr uri;
- rv = pNetService->NewURI(aPropFileName, nsnull, getter_AddRefs(uri));
- if (NS_SUCCEEDED(rv)) {
-
- // Create bundle
- nsCOMPtr stringService =
- do_GetService(kStringBundleServiceCID, &rv);
- if (NS_SUCCEEDED(rv)) {
- nsXPIDLCString spec;
- rv = uri->GetSpec(getter_Copies(spec));
- if (NS_SUCCEEDED(rv) && spec) {
- rv = stringService->CreateBundle(spec, aBundle);
- }
- }
- }
- }
+
+ nsCOMPtr stringService =
+ do_GetService(kStringBundleServiceCID, &rv);
+ if (NS_SUCCEEDED(rv))
+ rv = stringService->CreateBundle(aPropFileName, aBundle);
+
return rv;
}