diff --git a/accessible/generic/Accessible.cpp b/accessible/generic/Accessible.cpp index 90824577e5d5..62df58716e85 100644 --- a/accessible/generic/Accessible.cpp +++ b/accessible/generic/Accessible.cpp @@ -317,10 +317,9 @@ Accessible::TranslateString(const nsString& aKey, nsAString& aStringOut) if (!stringBundle) return; - nsXPIDLString xsValue; + nsAutoString xsValue; nsresult rv = - stringBundle->GetStringFromName(NS_ConvertUTF16toUTF8(aKey).get(), - getter_Copies(xsValue)); + stringBundle->GetStringFromName(NS_ConvertUTF16toUTF8(aKey).get(), xsValue); if (NS_SUCCEEDED(rv)) aStringOut.Assign(xsValue); } @@ -2835,37 +2834,32 @@ KeyBinding::ToPlatformFormat(nsAString& aValue) const return; nsAutoString separator; - keyStringBundle->GetStringFromName("MODIFIER_SEPARATOR", - getter_Copies(separator)); + keyStringBundle->GetStringFromName("MODIFIER_SEPARATOR", separator); nsAutoString modifierName; if (mModifierMask & kControl) { - keyStringBundle->GetStringFromName("VK_CONTROL", - getter_Copies(modifierName)); + keyStringBundle->GetStringFromName("VK_CONTROL", modifierName); aValue.Append(modifierName); aValue.Append(separator); } if (mModifierMask & kAlt) { - keyStringBundle->GetStringFromName("VK_ALT", - getter_Copies(modifierName)); + keyStringBundle->GetStringFromName("VK_ALT", modifierName); aValue.Append(modifierName); aValue.Append(separator); } if (mModifierMask & kShift) { - keyStringBundle->GetStringFromName("VK_SHIFT", - getter_Copies(modifierName)); + keyStringBundle->GetStringFromName("VK_SHIFT", modifierName); aValue.Append(modifierName); aValue.Append(separator); } if (mModifierMask & kMeta) { - keyStringBundle->GetStringFromName("VK_META", - getter_Copies(modifierName)); + keyStringBundle->GetStringFromName("VK_META", modifierName); aValue.Append(modifierName); aValue.Append(separator); diff --git a/accessible/generic/ApplicationAccessible.cpp b/accessible/generic/ApplicationAccessible.cpp index 6679944d6f2c..6bb69fbb272a 100644 --- a/accessible/generic/ApplicationAccessible.cpp +++ b/accessible/generic/ApplicationAccessible.cpp @@ -53,8 +53,8 @@ ApplicationAccessible::Name(nsString& aName) if (NS_FAILED(rv)) return eNameOK; - nsXPIDLString appName; - rv = bundle->GetStringFromName("brandShortName", getter_Copies(appName)); + nsAutoString appName; + rv = bundle->GetStringFromName("brandShortName", appName); if (NS_FAILED(rv) || appName.IsEmpty()) { NS_WARNING("brandShortName not found, using default app name"); appName.AssignLiteral("Gecko based application"); diff --git a/browser/components/shell/nsGNOMEShellService.cpp b/browser/components/shell/nsGNOMEShellService.cpp index 5ebeb5e66a87..8c710798dbcc 100644 --- a/browser/components/shell/nsGNOMEShellService.cpp +++ b/browser/components/shell/nsGNOMEShellService.cpp @@ -288,9 +288,8 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes, rv = bundleService->CreateBundle(BRAND_PROPERTIES, getter_AddRefs(brandBundle)); NS_ENSURE_SUCCESS(rv, rv); - nsString brandShortName; - brandBundle->GetStringFromName("brandShortName", - getter_Copies(brandShortName)); + nsAutoString brandShortName; + brandBundle->GetStringFromName("brandShortName", brandShortName); // use brandShortName as the application id. NS_ConvertUTF16toUTF8 id(brandShortName); @@ -399,7 +398,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement, nsAutoCString filePath(PR_GetEnv("HOME")); // get the product brand name from localized strings - nsString brandName; + nsAutoString brandName; nsCID bundleCID = NS_STRINGBUNDLESERVICE_CID; nsCOMPtr bundleService(do_GetService(bundleCID)); if (bundleService) { @@ -407,8 +406,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement, rv = bundleService->CreateBundle(BRAND_PROPERTIES, getter_AddRefs(brandBundle)); if (NS_SUCCEEDED(rv) && brandBundle) { - rv = brandBundle->GetStringFromName("brandShortName", - getter_Copies(brandName)); + rv = brandBundle->GetStringFromName("brandShortName", brandName); NS_ENSURE_SUCCESS(rv, rv); } } diff --git a/browser/components/shell/nsWindowsShellService.cpp b/browser/components/shell/nsWindowsShellService.cpp index d38453075465..43cda7d80e89 100644 --- a/browser/components/shell/nsWindowsShellService.cpp +++ b/browser/components/shell/nsWindowsShellService.cpp @@ -614,10 +614,9 @@ nsWindowsShellService::SetDesktopBackground(nsIDOMElement* aElement, NS_ENSURE_SUCCESS(rv, rv); // e.g. "Desktop Background.bmp" - nsString fileLeafName; - rv = shellBundle->GetStringFromName - ("desktopBackgroundLeafNameWin", - getter_Copies(fileLeafName)); + nsAutoString fileLeafName; + rv = shellBundle->GetStringFromName("desktopBackgroundLeafNameWin", + fileLeafName); NS_ENSURE_SUCCESS(rv, rv); // get the profile root directory diff --git a/caps/nsScriptSecurityManager.cpp b/caps/nsScriptSecurityManager.cpp index 90695ebd126f..db589560c9dd 100644 --- a/caps/nsScriptSecurityManager.cpp +++ b/caps/nsScriptSecurityManager.cpp @@ -1003,14 +1003,14 @@ nsScriptSecurityManager::CheckLoadURIFlags(nsIURI *aSourceURI, &hasSubsumersFlag); NS_ENSURE_SUCCESS(rv, rv); if (!hasFlags && !hasSubsumersFlag) { - nsXPIDLString message; + nsAutoString message; NS_ConvertASCIItoUTF16 ucsTargetScheme(targetScheme); const char16_t* formatStrings[] = { ucsTargetScheme.get() }; rv = sStrBundle-> FormatStringFromName("ProtocolFlagError", formatStrings, ArrayLength(formatStrings), - getter_Copies(message)); + message); if (NS_SUCCEEDED(rv)) { nsCOMPtr console( do_GetService("@mozilla.org/consoleservice;1")); @@ -1041,14 +1041,14 @@ nsScriptSecurityManager::ReportError(JSContext* cx, const char* aMessageTag, NS_ENSURE_SUCCESS(rv, rv); // Localize the error message - nsXPIDLString message; + nsAutoString message; NS_ConvertASCIItoUTF16 ucsSourceSpec(sourceSpec); NS_ConvertASCIItoUTF16 ucsTargetSpec(targetSpec); const char16_t *formatStrings[] = { ucsSourceSpec.get(), ucsTargetSpec.get() }; rv = sStrBundle->FormatStringFromName(aMessageTag, formatStrings, ArrayLength(formatStrings), - getter_Copies(message)); + message); NS_ENSURE_SUCCESS(rv, rv); // If a JS context was passed in, set a JS exception. @@ -1285,20 +1285,20 @@ nsScriptSecurityManager::CanCreateWrapper(JSContext *cx, NS_ConvertUTF8toUTF16 originUnicode(origin); NS_ConvertUTF8toUTF16 classInfoName(objClassInfo.GetName()); nsresult rv; - nsXPIDLString errorMsg; + nsAutoString errorMsg; if (originUnicode.IsEmpty()) { const char16_t* formatStrings[] = { classInfoName.get() }; rv = sStrBundle->FormatStringFromName("CreateWrapperDenied", formatStrings, 1, - getter_Copies(errorMsg)); + errorMsg); } else { const char16_t* formatStrings[] = { classInfoName.get(), originUnicode.get() }; rv = sStrBundle->FormatStringFromName("CreateWrapperDeniedForOrigin", formatStrings, 2, - getter_Copies(errorMsg)); + errorMsg); } NS_ENSURE_SUCCESS(rv, rv); diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index f5d9001191d8..a0b026fe53b8 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -5305,9 +5305,8 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI, for (uint32_t i = 0; i < formatStrCount; i++) { strs[i] = formatStrs[i].get(); } - nsXPIDLString str; - rv = stringBundle->FormatStringFromName(error, strs, formatStrCount, - getter_Copies(str)); + nsAutoString str; + rv = stringBundle->FormatStringFromName(error, strs, formatStrCount, str); NS_ENSURE_SUCCESS(rv, rv); messageStr.Assign(str.get()); } @@ -13372,14 +13371,12 @@ nsDocShell::ConfirmRepost(bool* aRepost) NS_ASSERTION(prompter && brandBundle && appBundle, "Unable to set up repost prompter."); - nsXPIDLString brandName; - rv = brandBundle->GetStringFromName("brandShortName", - getter_Copies(brandName)); + nsAutoString brandName; + rv = brandBundle->GetStringFromName("brandShortName", brandName); - nsXPIDLString msgString, button0Title; + nsAutoString msgString, button0Title; if (NS_FAILED(rv)) { // No brand, use the generic version. - rv = appBundle->GetStringFromName("confirmRepostPrompt", - getter_Copies(msgString)); + rv = appBundle->GetStringFromName("confirmRepostPrompt", msgString); } else { // Brand available - if the app has an override file with formatting, the // app name will be included. Without an override, the prompt will look @@ -13388,14 +13385,13 @@ nsDocShell::ConfirmRepost(bool* aRepost) rv = appBundle->FormatStringFromName("confirmRepostPrompt", formatStrings, ArrayLength(formatStrings), - getter_Copies(msgString)); + msgString); } if (NS_FAILED(rv)) { return rv; } - rv = appBundle->GetStringFromName("resendButton.label", - getter_Copies(button0Title)); + rv = appBundle->GetStringFromName("resendButton.label", button0Title); if (NS_FAILED(rv)) { return rv; } diff --git a/dom/animation/AnimationPerformanceWarning.cpp b/dom/animation/AnimationPerformanceWarning.cpp index d8917cee0147..e791845ea134 100644 --- a/dom/animation/AnimationPerformanceWarning.cpp +++ b/dom/animation/AnimationPerformanceWarning.cpp @@ -12,7 +12,7 @@ namespace mozilla { template nsresult AnimationPerformanceWarning::ToLocalizedStringWithIntParams( - const char* aKey, nsXPIDLString& aLocalizedString) const + const char* aKey, nsAString& aLocalizedString) const { nsAutoString strings[N]; const char16_t* charParams[N]; @@ -28,7 +28,7 @@ AnimationPerformanceWarning::ToLocalizedStringWithIntParams( bool AnimationPerformanceWarning::ToLocalizedString( - nsXPIDLString& aLocalizedString) const + nsAString& aLocalizedString) const { const char* key = nullptr; diff --git a/dom/animation/AnimationPerformanceWarning.h b/dom/animation/AnimationPerformanceWarning.h index 63296ef69403..c0ee92cc89aa 100644 --- a/dom/animation/AnimationPerformanceWarning.h +++ b/dom/animation/AnimationPerformanceWarning.h @@ -12,7 +12,7 @@ #include "mozilla/Maybe.h" #include "nsTArray.h" -class nsXPIDLString; +class nsAString; namespace mozilla { @@ -62,10 +62,10 @@ struct AnimationPerformanceWarning // Optional parameters that may be used for localization. Maybe> mParams; - bool ToLocalizedString(nsXPIDLString& aLocalizedString) const; + bool ToLocalizedString(nsAString& aLocalizedString) const; template nsresult ToLocalizedStringWithIntParams( - const char* aKey, nsXPIDLString& aLocalizedString) const; + const char* aKey, nsAString& aLocalizedString) const; bool operator==(const AnimationPerformanceWarning& aOther) const { diff --git a/dom/animation/KeyframeEffectReadOnly.cpp b/dom/animation/KeyframeEffectReadOnly.cpp index d7289bf12978..692c999be3a6 100644 --- a/dom/animation/KeyframeEffectReadOnly.cpp +++ b/dom/animation/KeyframeEffectReadOnly.cpp @@ -1139,7 +1139,7 @@ KeyframeEffectReadOnly::GetProperties( NS_ConvertASCIItoUTF16(nsCSSProps::GetStringValue(property.mProperty)); propertyDetails.mRunningOnCompositor = property.mIsRunningOnCompositor; - nsXPIDLString localizedString; + nsAutoString localizedString; if (property.mPerformanceWarning && property.mPerformanceWarning->ToLocalizedString(localizedString)) { propertyDetails.mWarning.Construct(localizedString); @@ -1621,7 +1621,7 @@ KeyframeEffectReadOnly::SetPerformanceWarning( *property.mPerformanceWarning != aWarning)) { property.mPerformanceWarning = Some(aWarning); - nsXPIDLString localizedString; + nsAutoString localizedString; if (nsLayoutUtils::IsAnimationLoggingEnabled() && property.mPerformanceWarning->ToLocalizedString(localizedString)) { nsAutoCString logMessage = NS_ConvertUTF16toUTF8(localizedString); diff --git a/dom/base/EventSource.cpp b/dom/base/EventSource.cpp index 2c23da6ab414..c8b265f788c9 100644 --- a/dom/base/EventSource.cpp +++ b/dom/base/EventSource.cpp @@ -1243,13 +1243,12 @@ EventSourceImpl::PrintErrorOnConsole(const char* aBundleURI, NS_ENSURE_SUCCESS(rv, rv); // Localize the error message - nsXPIDLString message; + nsAutoString message; if (aFormatStrings) { rv = strBundle->FormatStringFromName(aError, aFormatStrings, - aFormatStringsLen, - getter_Copies(message)); + aFormatStringsLen, message); } else { - rv = strBundle->GetStringFromName(aError, getter_Copies(message)); + rv = strBundle->GetStringFromName(aError, message); } NS_ENSURE_SUCCESS(rv, rv); diff --git a/dom/base/WebSocket.cpp b/dom/base/WebSocket.cpp index 143702c68ce5..c579d0149de2 100644 --- a/dom/base/WebSocket.cpp +++ b/dom/base/WebSocket.cpp @@ -371,13 +371,12 @@ WebSocketImpl::PrintErrorOnConsole(const char *aBundleURI, NS_ENSURE_SUCCESS_VOID(rv); // Localize the error message - nsXPIDLString message; + nsAutoString message; if (aFormatStrings) { rv = strBundle->FormatStringFromName(aError, aFormatStrings, - aFormatStringsLen, - getter_Copies(message)); + aFormatStringsLen, message); } else { - rv = strBundle->GetStringFromName(aError, getter_Copies(message)); + rv = strBundle->GetStringFromName(aError, message); } NS_ENSURE_SUCCESS_VOID(rv); diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index acdcc27371d0..dc77a50364ce 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -864,20 +864,20 @@ nsContentUtils::InitializeModifierStrings() } NS_ASSERTION(NS_SUCCEEDED(rv) && bundle, "chrome://global/locale/platformKeys.properties could not be loaded"); - nsXPIDLString shiftModifier; - nsXPIDLString metaModifier; - nsXPIDLString osModifier; - nsXPIDLString altModifier; - nsXPIDLString controlModifier; - nsXPIDLString modifierSeparator; + nsAutoString shiftModifier; + nsAutoString metaModifier; + nsAutoString osModifier; + nsAutoString altModifier; + nsAutoString controlModifier; + nsAutoString modifierSeparator; if (bundle) { //macs use symbols for each modifier key, so fetch each from the bundle, which also covers i18n - bundle->GetStringFromName("VK_SHIFT", getter_Copies(shiftModifier)); - bundle->GetStringFromName("VK_META", getter_Copies(metaModifier)); - bundle->GetStringFromName("VK_WIN", getter_Copies(osModifier)); - bundle->GetStringFromName("VK_ALT", getter_Copies(altModifier)); - bundle->GetStringFromName("VK_CONTROL", getter_Copies(controlModifier)); - bundle->GetStringFromName("MODIFIER_SEPARATOR", getter_Copies(modifierSeparator)); + bundle->GetStringFromName("VK_SHIFT", shiftModifier); + bundle->GetStringFromName("VK_META", metaModifier); + bundle->GetStringFromName("VK_WIN", osModifier); + bundle->GetStringFromName("VK_ALT", altModifier); + bundle->GetStringFromName("VK_CONTROL", controlModifier); + bundle->GetStringFromName("MODIFIER_SEPARATOR", modifierSeparator); } //if any of these don't exist, we get an empty string sShiftText = new nsString(shiftModifier); @@ -3957,13 +3957,12 @@ nsContentUtils::EnsureStringBundle(PropertiesFile aFile) /* static */ nsresult nsContentUtils::GetLocalizedString(PropertiesFile aFile, const char* aKey, - nsXPIDLString& aResult) + nsAString& aResult) { nsresult rv = EnsureStringBundle(aFile); NS_ENSURE_SUCCESS(rv, rv); nsIStringBundle *bundle = sStringBundles[aFile]; - - return bundle->GetStringFromName(aKey, getter_Copies(aResult)); + return bundle->GetStringFromName(aKey, aResult); } /* static */ @@ -3971,19 +3970,17 @@ nsresult nsContentUtils::FormatLocalizedString(PropertiesFile aFile, const char* aKey, const char16_t **aParams, uint32_t aParamsLength, - nsXPIDLString& aResult) + nsAString& aResult) { nsresult rv = EnsureStringBundle(aFile); NS_ENSURE_SUCCESS(rv, rv); nsIStringBundle *bundle = sStringBundles[aFile]; if (!aParams || !aParamsLength) { - return bundle->GetStringFromName(aKey, getter_Copies(aResult)); + return bundle->GetStringFromName(aKey, aResult); } - return bundle->FormatStringFromName(aKey, - aParams, aParamsLength, - getter_Copies(aResult)); + return bundle->FormatStringFromName(aKey, aParams, aParamsLength, aResult); } /* static */ @@ -3991,7 +3988,7 @@ nsresult nsContentUtils::FormatLocalizedString( PropertiesFile aFile, const char* aKey, const nsTArray& aParamArray, - nsXPIDLString& aResult) + nsAString& aResult) { MOZ_ASSERT(NS_IsMainThread()); @@ -4044,7 +4041,7 @@ nsContentUtils::ReportToConsole(uint32_t aErrorFlags, "parameters and 0."); nsresult rv; - nsXPIDLString errorText; + nsAutoString errorText; if (aParams) { rv = FormatLocalizedString(aFile, aMessageName, aParams, aParamsLength, errorText); diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index fe7b5ab0ef08..47260e7e4d3c 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -1040,7 +1040,7 @@ public: */ static nsresult GetLocalizedString(PropertiesFile aFile, const char* aKey, - nsXPIDLString& aResult); + nsAString& aResult); /** * A helper function that parses a sandbox attribute (of an