mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 21:28:55 +00:00
merge mozilla-inbound to mozilla-central a=merge
This commit is contained in:
commit
e54b14cf9a
@ -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);
|
||||
|
@ -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");
|
||||
|
@ -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<nsIStringBundleService> 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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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<nsIConsoleService> 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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace mozilla {
|
||||
|
||||
template<uint32_t N> 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;
|
||||
|
||||
|
@ -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<nsTArray<int32_t>> mParams;
|
||||
|
||||
bool ToLocalizedString(nsXPIDLString& aLocalizedString) const;
|
||||
bool ToLocalizedString(nsAString& aLocalizedString) const;
|
||||
template<uint32_t N>
|
||||
nsresult ToLocalizedStringWithIntParams(
|
||||
const char* aKey, nsXPIDLString& aLocalizedString) const;
|
||||
const char* aKey, nsAString& aLocalizedString) const;
|
||||
|
||||
bool operator==(const AnimationPerformanceWarning& aOther) const
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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<nsString>& 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);
|
||||
|
@ -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 <iframe> or a CSP
|
||||
@ -1086,14 +1086,14 @@ private:
|
||||
const char* aKey,
|
||||
const char16_t** aParams,
|
||||
uint32_t aParamsLength,
|
||||
nsXPIDLString& aResult);
|
||||
nsAString& aResult);
|
||||
|
||||
public:
|
||||
template<uint32_t N>
|
||||
static nsresult FormatLocalizedString(PropertiesFile aFile,
|
||||
const char* aKey,
|
||||
const char16_t* (&aParams)[N],
|
||||
nsXPIDLString& aResult)
|
||||
nsAString& aResult)
|
||||
{
|
||||
return FormatLocalizedString(aFile, aKey, aParams, N, aResult);
|
||||
}
|
||||
@ -1107,7 +1107,7 @@ public:
|
||||
static nsresult FormatLocalizedString(PropertiesFile aFile,
|
||||
const char* aKey,
|
||||
const nsTArray<nsString>& aParamArray,
|
||||
nsXPIDLString& aResult);
|
||||
nsAString& aResult);
|
||||
|
||||
/**
|
||||
* Returns true if aDocument is a chrome document
|
||||
|
@ -3894,7 +3894,7 @@ nsGlobalWindow::ConfirmDialogIfNeeded()
|
||||
nsAutoPopupStatePusher popupStatePusher(openAbused, true);
|
||||
|
||||
bool disableDialog = false;
|
||||
nsXPIDLString label, title;
|
||||
nsAutoString label, title;
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
|
||||
"ScriptDialogLabel", label);
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
|
||||
@ -7508,12 +7508,10 @@ nsGlobalWindow::MakeScriptDialogTitle(nsAString& aOutTitle,
|
||||
|
||||
NS_ConvertUTF8toUTF16 ucsPrePath(prepath);
|
||||
const char16_t *formatStrings[] = { ucsPrePath.get() };
|
||||
nsXPIDLString tempString;
|
||||
nsContentUtils::FormatLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
|
||||
"ScriptDlgHeading",
|
||||
formatStrings,
|
||||
tempString);
|
||||
aOutTitle = tempString;
|
||||
aOutTitle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7521,11 +7519,9 @@ nsGlobalWindow::MakeScriptDialogTitle(nsAString& aOutTitle,
|
||||
|
||||
if (aOutTitle.IsEmpty()) {
|
||||
// We didn't find a host so use the generic heading
|
||||
nsXPIDLString tempString;
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
|
||||
"ScriptDlgGenericHeading",
|
||||
tempString);
|
||||
aOutTitle = tempString;
|
||||
aOutTitle);
|
||||
}
|
||||
|
||||
// Just in case
|
||||
@ -7649,7 +7645,7 @@ nsGlobalWindow::AlertOrConfirm(bool aAlert,
|
||||
nsAutoSyncOperation sync(mDoc);
|
||||
if (ShouldPromptToBlockDialogs()) {
|
||||
bool disallowDialog = false;
|
||||
nsXPIDLString label;
|
||||
nsAutoString label;
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
|
||||
"ScriptDialogLabel", label);
|
||||
|
||||
@ -7784,7 +7780,8 @@ nsGlobalWindow::PromptOuter(const nsAString& aMessage,
|
||||
char16_t *inoutValue = ToNewUnicode(fixedInitial);
|
||||
bool disallowDialog = false;
|
||||
|
||||
nsXPIDLString label;
|
||||
nsAutoString label;
|
||||
label.SetIsVoid(true);
|
||||
if (ShouldPromptToBlockDialogs()) {
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eCOMMON_DIALOG_PROPERTIES,
|
||||
"ScriptDialogLabel", label);
|
||||
@ -7792,8 +7789,9 @@ nsGlobalWindow::PromptOuter(const nsAString& aMessage,
|
||||
|
||||
nsAutoSyncOperation sync(mDoc);
|
||||
bool ok;
|
||||
aError = prompt->Prompt(title.get(), fixedMessage.get(),
|
||||
&inoutValue, label.get(), &disallowDialog, &ok);
|
||||
aError = prompt->Prompt(title.get(), fixedMessage.get(), &inoutValue,
|
||||
label.IsVoid() ? nullptr : label.get(),
|
||||
&disallowDialog, &ok);
|
||||
|
||||
if (disallowDialog) {
|
||||
DisableDialogs();
|
||||
@ -8144,7 +8142,7 @@ nsGlobalWindow::PrintOuter(ErrorResult& aError)
|
||||
if (printSettingsAreGlobal) {
|
||||
printSettingsService->GetGlobalPrintSettings(getter_AddRefs(printSettings));
|
||||
|
||||
nsXPIDLString printerName;
|
||||
nsAutoString printerName;
|
||||
printSettings->GetPrinterName(getter_Copies(printerName));
|
||||
|
||||
bool shouldGetDefaultPrinterName = printerName.IsEmpty();
|
||||
@ -8160,9 +8158,10 @@ nsGlobalWindow::PrintOuter(ErrorResult& aError)
|
||||
#endif
|
||||
if (shouldGetDefaultPrinterName) {
|
||||
printSettingsService->GetDefaultPrinterName(getter_Copies(printerName));
|
||||
printSettings->SetPrinterName(printerName);
|
||||
printSettings->SetPrinterName(printerName.get());
|
||||
}
|
||||
printSettingsService->InitPrintSettingsFromPrinter(printerName, printSettings);
|
||||
printSettingsService->InitPrintSettingsFromPrinter(printerName.get(),
|
||||
printSettings);
|
||||
printSettingsService->InitPrintSettingsFromPrefs(printSettings,
|
||||
true,
|
||||
nsIPrintSettings::kInitSaveAll);
|
||||
@ -11956,7 +11955,7 @@ nsGlobalWindow::ShowSlowScriptDialog()
|
||||
bool showDebugButton = !!debugCallback;
|
||||
|
||||
// Get localizable strings
|
||||
nsXPIDLString title, msg, stopButton, waitButton, debugButton, neverShowDlg;
|
||||
nsAutoString title, msg, stopButton, waitButton, debugButton, neverShowDlg;
|
||||
|
||||
rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"KillScriptTitle",
|
||||
@ -11983,7 +11982,6 @@ nsGlobalWindow::ShowSlowScriptDialog()
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
|
||||
if (showDebugButton) {
|
||||
tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"DebugScriptButton",
|
||||
@ -12008,16 +12006,14 @@ nsGlobalWindow::ShowSlowScriptDialog()
|
||||
}
|
||||
}
|
||||
|
||||
// GetStringFromName can return NS_OK and still give nullptr string
|
||||
if (NS_FAILED(rv) || !title || !msg || !stopButton || !waitButton ||
|
||||
(!debugButton && showDebugButton) || !neverShowDlg) {
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Failed to get localized strings.");
|
||||
return ContinueSlowScript;
|
||||
}
|
||||
|
||||
// Append file and line number information, if available
|
||||
if (filename.get()) {
|
||||
nsXPIDLString scriptLocation;
|
||||
nsAutoString scriptLocation;
|
||||
// We want to drop the middle part of too-long locations. We'll
|
||||
// define "too-long" as longer than 60 UTF-16 code units. Just
|
||||
// have to be a bit careful about unpaired surrogates.
|
||||
@ -12050,7 +12046,7 @@ nsGlobalWindow::ShowSlowScriptDialog()
|
||||
formatParams,
|
||||
scriptLocation);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && scriptLocation) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
msg.AppendLiteral("\n\n");
|
||||
msg.Append(scriptLocation);
|
||||
msg.Append(':');
|
||||
@ -12072,9 +12068,10 @@ nsGlobalWindow::ShowSlowScriptDialog()
|
||||
// Null out the operation callback while we're re-entering JS here.
|
||||
AutoDisableJSInterruptCallback disabler(cx);
|
||||
// Open the dialog.
|
||||
rv = prompt->ConfirmEx(title, msg, buttonFlags, waitButton, stopButton,
|
||||
debugButton, neverShowDlg, &neverShowDlgChk,
|
||||
&buttonPressed);
|
||||
rv = prompt->ConfirmEx(title.get(), msg.get(), buttonFlags,
|
||||
waitButton.get(), stopButton.get(),
|
||||
debugButton.get(), neverShowDlg.get(),
|
||||
&neverShowDlgChk, &buttonPressed);
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && (buttonPressed == 0)) {
|
||||
|
1
dom/base/test/FAIL.html
Normal file
1
dom/base/test/FAIL.html
Normal file
@ -0,0 +1 @@
|
||||
FAIL
|
@ -248,6 +248,7 @@ support-files =
|
||||
file3_setting_opener.html
|
||||
file4_setting_opener.html
|
||||
PASS.html
|
||||
FAIL.html
|
||||
window_bug1384658.html
|
||||
|
||||
[test_anchor_area_referrer.html]
|
||||
|
@ -28,8 +28,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=331959
|
||||
/** Test for Bug 331959 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
const FAILURL = "data:text/plain,FAIL";
|
||||
const PASSURL = "data:text/plain,PASS";
|
||||
const FAILURL = "FAIL.html";
|
||||
const PASSURL = "PASS.html";
|
||||
|
||||
var currentTest = 0;
|
||||
var tests = [ testLinkInLinkMouse, testLinkInLinkKeyboard,
|
||||
@ -55,7 +55,7 @@ function generateLinkInLink(id, desc) {
|
||||
outerA.appendChild(innerA);
|
||||
doc.body.appendChild(outerA);
|
||||
$(id).onload = function() {
|
||||
is(this.contentDocument.documentElement.textContent, "PASS", desc);
|
||||
is(this.contentDocument.documentElement.innerText, "PASS", desc);
|
||||
// Have to remove the iframe we used from the DOM, because the harness is
|
||||
// stupid and doesn't have enough space for more than one iframe.
|
||||
$(id).remove();
|
||||
@ -85,7 +85,7 @@ function generateInputInLink(id, desc) {
|
||||
"<form action='" + PASSURL + "'><a href='" + FAILURL +
|
||||
"'><input type='submit' id='submit'>";
|
||||
$(id).onload = function() {
|
||||
is(this.contentDocument.documentElement.textContent, "PASS?", desc);
|
||||
is(this.contentDocument.documentElement.innerText, "PASS", desc);
|
||||
// Have to remove the iframe we used from the DOM, because the harness is
|
||||
// stupid and doesn't have enough space for more than one iframe.
|
||||
$(id).remove();
|
||||
@ -117,7 +117,7 @@ function generateButtonInLink(id, desc) {
|
||||
"<form action='" + PASSURL + "'><a href='" + FAILURL +
|
||||
"'><button type='submit' id='submit'>Submit</button>";
|
||||
$(id).onload = function() {
|
||||
is(this.contentDocument.documentElement.textContent, "PASS?", desc);
|
||||
is(this.contentDocument.documentElement.innerText, "PASS", desc);
|
||||
// Have to remove the iframe we used from the DOM, because the harness is
|
||||
// stupid and doesn't have enough space for more than one iframe.
|
||||
$(id).remove();
|
||||
|
@ -56,7 +56,7 @@ ConsoleReportCollector::FlushReportsToConsole(uint64_t aInnerWindowID,
|
||||
for (uint32_t i = 0; i < reports.Length(); ++i) {
|
||||
PendingReport& report = reports[i];
|
||||
|
||||
nsXPIDLString errorText;
|
||||
nsAutoString errorText;
|
||||
nsresult rv;
|
||||
if (!report.mStringParams.IsEmpty()) {
|
||||
rv = nsContentUtils::FormatLocalizedString(report.mPropertiesFile,
|
||||
|
@ -388,7 +388,7 @@ DataTransferItem::CreateFileFromInputStream(nsIInputStream* aStream)
|
||||
key = "GenericFileName";
|
||||
}
|
||||
|
||||
nsXPIDLString fileName;
|
||||
nsAutoString fileName;
|
||||
nsresult rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
key, fileName);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
@ -919,11 +919,11 @@ HTMLFormElement::DoSecureToInsecureSubmitCheck(nsIURI* aActionURL,
|
||||
nsAutoString message;
|
||||
nsAutoString cont;
|
||||
stringBundle->GetStringFromName(
|
||||
"formPostSecureToInsecureWarning.title", getter_Copies(title));
|
||||
"formPostSecureToInsecureWarning.title", title);
|
||||
stringBundle->GetStringFromName(
|
||||
"formPostSecureToInsecureWarning.message", getter_Copies(message));
|
||||
"formPostSecureToInsecureWarning.message", message);
|
||||
stringBundle->GetStringFromName(
|
||||
"formPostSecureToInsecureWarning.continue", getter_Copies(cont));
|
||||
"formPostSecureToInsecureWarning.continue", cont);
|
||||
int32_t buttonPressed;
|
||||
bool checkState = false; // this is unused (ConfirmEx requires this parameter)
|
||||
rv = prompt->ConfirmEx(title.get(), message.get(),
|
||||
|
@ -238,14 +238,14 @@ HandleMailtoSubject(nsCString& aPath)
|
||||
}
|
||||
|
||||
// Get the default subject
|
||||
nsXPIDLString brandName;
|
||||
nsAutoString brandName;
|
||||
nsresult rv =
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eBRAND_PROPERTIES,
|
||||
"brandShortName", brandName);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
const char16_t *formatStrings[] = { brandName.get() };
|
||||
nsXPIDLString subjectStr;
|
||||
nsAutoString subjectStr;
|
||||
rv = nsContentUtils::FormatLocalizedString(
|
||||
nsContentUtils::eFORMS_PROPERTIES,
|
||||
"DefaultFormSubject",
|
||||
|
@ -854,7 +854,7 @@ HTMLInputElement::InitColorPicker()
|
||||
}
|
||||
|
||||
// Get Loc title
|
||||
nsXPIDLString title;
|
||||
nsAutoString title;
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
|
||||
"ColorPicker", title);
|
||||
|
||||
@ -901,8 +901,8 @@ HTMLInputElement::InitFilePicker(FilePickerType aType)
|
||||
}
|
||||
|
||||
// Get Loc title
|
||||
nsXPIDLString title;
|
||||
nsXPIDLString okButtonLabel;
|
||||
nsAutoString title;
|
||||
nsAutoString okButtonLabel;
|
||||
if (aType == FILE_PICKER_DIRECTORY) {
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
|
||||
"DirectoryUpload", title);
|
||||
@ -2769,7 +2769,7 @@ HTMLInputElement::GetDisplayFileName(nsAString& aValue) const
|
||||
return;
|
||||
}
|
||||
|
||||
nsXPIDLString value;
|
||||
nsAutoString value;
|
||||
|
||||
if (mFileData->mFilesOrDirectories.IsEmpty()) {
|
||||
if ((IsDirPickerEnabled() && Allowdirs()) ||
|
||||
@ -6415,7 +6415,7 @@ HTMLInputElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission)
|
||||
if (mType == NS_FORM_INPUT_SUBMIT && value.IsEmpty() &&
|
||||
!HasAttr(kNameSpaceID_None, nsGkAtoms::value)) {
|
||||
// Get our default value, which is the same as our default label
|
||||
nsXPIDLString defaultValue;
|
||||
nsAutoString defaultValue;
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
|
||||
"Submit", defaultValue);
|
||||
value = defaultValue;
|
||||
@ -7570,15 +7570,15 @@ HTMLInputElement::SetFilePickerFiltersFromAccept(nsIFilePicker* filePicker)
|
||||
if (token.EqualsLiteral("image/*")) {
|
||||
filterMask = nsIFilePicker::filterImages;
|
||||
filterBundle->GetStringFromName("imageFilter",
|
||||
getter_Copies(extensionListStr));
|
||||
extensionListStr);
|
||||
} else if (token.EqualsLiteral("audio/*")) {
|
||||
filterMask = nsIFilePicker::filterAudio;
|
||||
filterBundle->GetStringFromName("audioFilter",
|
||||
getter_Copies(extensionListStr));
|
||||
extensionListStr);
|
||||
} else if (token.EqualsLiteral("video/*")) {
|
||||
filterMask = nsIFilePicker::filterVideo;
|
||||
filterBundle->GetStringFromName("videoFilter",
|
||||
getter_Copies(extensionListStr));
|
||||
extensionListStr);
|
||||
} else if (token.First() == '.') {
|
||||
if (token.Contains(';') || token.Contains('*')) {
|
||||
// Ignore this filter as it contains reserved characters
|
||||
@ -7681,7 +7681,7 @@ HTMLInputElement::SetFilePickerFiltersFromAccept(nsIFilePicker* filePicker)
|
||||
|
||||
// Add "All Supported Types" filter
|
||||
if (filters.Length() > 1) {
|
||||
nsXPIDLString title;
|
||||
nsAutoString title;
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
|
||||
"AllSupportedTypes", title);
|
||||
filePicker->AppendFilter(title, allExtensionsList);
|
||||
|
@ -1825,7 +1825,7 @@ HTMLSelectElement::GetValidationMessage(nsAString& aValidationMessage,
|
||||
{
|
||||
switch (aType) {
|
||||
case VALIDITY_STATE_VALUE_MISSING: {
|
||||
nsXPIDLString message;
|
||||
nsAutoString message;
|
||||
nsresult rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"FormValidationSelectMissing",
|
||||
message);
|
||||
|
@ -1262,7 +1262,7 @@ HTMLTextAreaElement::GetValidationMessage(nsAString& aValidationMessage,
|
||||
{
|
||||
case VALIDITY_STATE_TOO_LONG:
|
||||
{
|
||||
nsXPIDLString message;
|
||||
nsAutoString message;
|
||||
int32_t maxLength = -1;
|
||||
int32_t textLength = -1;
|
||||
nsAutoString strMaxLength;
|
||||
@ -1283,7 +1283,7 @@ HTMLTextAreaElement::GetValidationMessage(nsAString& aValidationMessage,
|
||||
break;
|
||||
case VALIDITY_STATE_TOO_SHORT:
|
||||
{
|
||||
nsXPIDLString message;
|
||||
nsAutoString message;
|
||||
int32_t minLength = -1;
|
||||
int32_t textLength = -1;
|
||||
nsAutoString strMinLength;
|
||||
@ -1304,7 +1304,7 @@ HTMLTextAreaElement::GetValidationMessage(nsAString& aValidationMessage,
|
||||
break;
|
||||
case VALIDITY_STATE_VALUE_MISSING:
|
||||
{
|
||||
nsXPIDLString message;
|
||||
nsAutoString message;
|
||||
rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"FormValidationValueMissing",
|
||||
message);
|
||||
|
@ -599,9 +599,9 @@ ImageDocument::OnLoadComplete(imgIRequest* aRequest, nsresult aStatus)
|
||||
mDocumentURI->GetSpec(src);
|
||||
NS_ConvertUTF8toUTF16 srcString(src);
|
||||
const char16_t* formatString[] = { srcString.get() };
|
||||
nsXPIDLString errorMsg;
|
||||
nsAutoString errorMsg;
|
||||
mStringBundle->FormatStringFromName("InvalidImage", formatString, 1,
|
||||
getter_Copies(errorMsg));
|
||||
errorMsg);
|
||||
|
||||
mImageContent->SetAttr(kNameSpaceID_None, nsGkAtoms::alt, errorMsg, false);
|
||||
}
|
||||
@ -805,15 +805,13 @@ ImageDocument::UpdateTitleAndCharset()
|
||||
}
|
||||
}
|
||||
|
||||
nsXPIDLString status;
|
||||
nsAutoString status;
|
||||
if (mImageIsResized) {
|
||||
nsAutoString ratioStr;
|
||||
ratioStr.AppendInt(NSToCoordFloor(GetRatio() * 100));
|
||||
|
||||
const char16_t* formatString[1] = { ratioStr.get() };
|
||||
mStringBundle->FormatStringFromName("ScaledImage",
|
||||
formatString, 1,
|
||||
getter_Copies(status));
|
||||
mStringBundle->FormatStringFromName("ScaledImage", formatString, 1, status);
|
||||
}
|
||||
|
||||
static const char* const formatNames[4] =
|
||||
|
@ -365,7 +365,7 @@ MediaDocument::UpdateTitleAndCharset(const nsACString& aTypeStr,
|
||||
GetFileName(fileStr, aChannel);
|
||||
|
||||
NS_ConvertASCIItoUTF16 typeStr(aTypeStr);
|
||||
nsXPIDLString title;
|
||||
nsAutoString title;
|
||||
|
||||
if (mStringBundle) {
|
||||
// if we got a valid size (not all media have a size)
|
||||
@ -379,15 +379,13 @@ MediaDocument::UpdateTitleAndCharset(const nsACString& aTypeStr,
|
||||
const char16_t *formatStrings[4] = {fileStr.get(), typeStr.get(),
|
||||
widthStr.get(), heightStr.get()};
|
||||
mStringBundle->FormatStringFromName(aFormatNames[eWithDimAndFile],
|
||||
formatStrings, 4,
|
||||
getter_Copies(title));
|
||||
formatStrings, 4, title);
|
||||
}
|
||||
else {
|
||||
const char16_t *formatStrings[3] = {typeStr.get(), widthStr.get(),
|
||||
heightStr.get()};
|
||||
mStringBundle->FormatStringFromName(aFormatNames[eWithDim],
|
||||
formatStrings, 3,
|
||||
getter_Copies(title));
|
||||
formatStrings, 3, title);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -395,14 +393,12 @@ MediaDocument::UpdateTitleAndCharset(const nsACString& aTypeStr,
|
||||
if (!fileStr.IsEmpty()) {
|
||||
const char16_t *formatStrings[2] = {fileStr.get(), typeStr.get()};
|
||||
mStringBundle->FormatStringFromName(aFormatNames[eWithFile],
|
||||
formatStrings, 2,
|
||||
getter_Copies(title));
|
||||
formatStrings, 2, title);
|
||||
}
|
||||
else {
|
||||
const char16_t *formatStrings[1] = {typeStr.get()};
|
||||
mStringBundle->FormatStringFromName(aFormatNames[eWithNoInfo],
|
||||
formatStrings, 1,
|
||||
getter_Copies(title));
|
||||
formatStrings, 1, title);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -412,11 +408,11 @@ MediaDocument::UpdateTitleAndCharset(const nsACString& aTypeStr,
|
||||
SetTitle(title);
|
||||
}
|
||||
else {
|
||||
nsXPIDLString titleWithStatus;
|
||||
nsAutoString titleWithStatus;
|
||||
const nsPromiseFlatString& status = PromiseFlatString(aStatus);
|
||||
const char16_t *formatStrings[2] = {title.get(), status.get()};
|
||||
mStringBundle->FormatStringFromName("TitleWithStatus", formatStrings,
|
||||
2, getter_Copies(titleWithStatus));
|
||||
2, titleWithStatus);
|
||||
SetTitle(titleWithStatus);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ CheckboxInputType::IsValueMissing() const
|
||||
}
|
||||
|
||||
nsresult
|
||||
CheckboxInputType::GetValueMissingMessage(nsXPIDLString& aMessage)
|
||||
CheckboxInputType::GetValueMissingMessage(nsAString& aMessage)
|
||||
{
|
||||
return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"FormValidationCheckboxMissing",
|
||||
@ -35,7 +35,7 @@ CheckboxInputType::GetValueMissingMessage(nsXPIDLString& aMessage)
|
||||
/* input type=radio */
|
||||
|
||||
nsresult
|
||||
RadioInputType::GetValueMissingMessage(nsXPIDLString& aMessage)
|
||||
RadioInputType::GetValueMissingMessage(nsAString& aMessage)
|
||||
{
|
||||
return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"FormValidationRadioMissing",
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
|
||||
bool IsValueMissing() const override;
|
||||
|
||||
nsresult GetValueMissingMessage(nsXPIDLString& aMessage) override;
|
||||
nsresult GetValueMissingMessage(nsAString& aMessage) override;
|
||||
|
||||
private:
|
||||
explicit CheckboxInputType(mozilla::dom::HTMLInputElement* aInputElement)
|
||||
@ -50,7 +50,7 @@ public:
|
||||
return new (aMemory) RadioInputType(aInputElement);
|
||||
}
|
||||
|
||||
nsresult GetValueMissingMessage(nsXPIDLString& aMessage) override;
|
||||
nsresult GetValueMissingMessage(nsAString& aMessage) override;
|
||||
|
||||
private:
|
||||
explicit RadioInputType(mozilla::dom::HTMLInputElement* aInputElement)
|
||||
|
@ -118,7 +118,7 @@ DateTimeInputTypeBase::HasBadInput() const
|
||||
}
|
||||
|
||||
nsresult
|
||||
DateTimeInputTypeBase::GetRangeOverflowMessage(nsXPIDLString& aMessage)
|
||||
DateTimeInputTypeBase::GetRangeOverflowMessage(nsAString& aMessage)
|
||||
{
|
||||
nsAutoString maxStr;
|
||||
mInputElement->GetAttr(kNameSpaceID_None, nsGkAtoms::max, maxStr);
|
||||
@ -129,7 +129,7 @@ DateTimeInputTypeBase::GetRangeOverflowMessage(nsXPIDLString& aMessage)
|
||||
}
|
||||
|
||||
nsresult
|
||||
DateTimeInputTypeBase::GetRangeUnderflowMessage(nsXPIDLString& aMessage)
|
||||
DateTimeInputTypeBase::GetRangeUnderflowMessage(nsAString& aMessage)
|
||||
{
|
||||
nsAutoString minStr;
|
||||
mInputElement->GetAttr(kNameSpaceID_None, nsGkAtoms::min, minStr);
|
||||
@ -176,7 +176,7 @@ DateTimeInputTypeBase::GetTimeFromMs(double aValue, uint16_t* aHours,
|
||||
// input type=date
|
||||
|
||||
nsresult
|
||||
DateInputType::GetBadInputMessage(nsXPIDLString& aMessage)
|
||||
DateInputType::GetBadInputMessage(nsAString& aMessage)
|
||||
{
|
||||
if (!IsInputDateTimeEnabled()) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
@ -20,8 +20,8 @@ public:
|
||||
bool HasStepMismatch(bool aUseZeroIfValueNaN) const override;
|
||||
bool HasBadInput() const override;
|
||||
|
||||
nsresult GetRangeOverflowMessage(nsXPIDLString& aMessage) override;
|
||||
nsresult GetRangeUnderflowMessage(nsXPIDLString& aMessage) override;
|
||||
nsresult GetRangeOverflowMessage(nsAString& aMessage) override;
|
||||
nsresult GetRangeUnderflowMessage(nsAString& aMessage) override;
|
||||
|
||||
nsresult MinMaxStepAttrChanged() override;
|
||||
|
||||
@ -71,7 +71,7 @@ public:
|
||||
// we forbid or autocorrect values that are not in the valid range for time.
|
||||
// For example, in 12hr format, if user enters '2' in the hour field, it will
|
||||
// be treated as '02' and automatically advance to the next field.
|
||||
nsresult GetBadInputMessage(nsXPIDLString& aMessage) override;
|
||||
nsresult GetBadInputMessage(nsAString& aMessage) override;
|
||||
|
||||
bool ConvertStringToNumber(nsAString& aValue,
|
||||
mozilla::Decimal& aResultValue) const override;
|
||||
|
@ -23,7 +23,7 @@ FileInputType::IsValueMissing() const
|
||||
}
|
||||
|
||||
nsresult
|
||||
FileInputType::GetValueMissingMessage(nsXPIDLString& aMessage)
|
||||
FileInputType::GetValueMissingMessage(nsAString& aMessage)
|
||||
{
|
||||
return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"FormValidationFileMissing",
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
|
||||
bool IsValueMissing() const override;
|
||||
|
||||
nsresult GetValueMissingMessage(nsXPIDLString& aMessage) override;
|
||||
nsresult GetValueMissingMessage(nsAString& aMessage) override;
|
||||
|
||||
private:
|
||||
explicit FileInputType(mozilla::dom::HTMLInputElement* aInputElement)
|
||||
|
@ -212,7 +212,7 @@ InputType::GetValidationMessage(nsAString& aValidationMessage,
|
||||
{
|
||||
case nsIConstraintValidation::VALIDITY_STATE_TOO_LONG:
|
||||
{
|
||||
nsXPIDLString message;
|
||||
nsAutoString message;
|
||||
int32_t maxLength = mInputElement->MaxLength();
|
||||
int32_t textLength =
|
||||
mInputElement->InputTextLength(mozilla::dom::CallerType::System);
|
||||
@ -231,7 +231,7 @@ InputType::GetValidationMessage(nsAString& aValidationMessage,
|
||||
}
|
||||
case nsIConstraintValidation::VALIDITY_STATE_TOO_SHORT:
|
||||
{
|
||||
nsXPIDLString message;
|
||||
nsAutoString message;
|
||||
int32_t minLength = mInputElement->MinLength();
|
||||
int32_t textLength =
|
||||
mInputElement->InputTextLength(mozilla::dom::CallerType::System);
|
||||
@ -251,7 +251,7 @@ InputType::GetValidationMessage(nsAString& aValidationMessage,
|
||||
}
|
||||
case nsIConstraintValidation::VALIDITY_STATE_VALUE_MISSING:
|
||||
{
|
||||
nsXPIDLString message;
|
||||
nsAutoString message;
|
||||
rv = GetValueMissingMessage(message);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
@ -262,7 +262,7 @@ InputType::GetValidationMessage(nsAString& aValidationMessage,
|
||||
}
|
||||
case nsIConstraintValidation::VALIDITY_STATE_TYPE_MISMATCH:
|
||||
{
|
||||
nsXPIDLString message;
|
||||
nsAutoString message;
|
||||
rv = GetTypeMismatchMessage(message);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
@ -273,7 +273,7 @@ InputType::GetValidationMessage(nsAString& aValidationMessage,
|
||||
}
|
||||
case nsIConstraintValidation::VALIDITY_STATE_PATTERN_MISMATCH:
|
||||
{
|
||||
nsXPIDLString message;
|
||||
nsAutoString message;
|
||||
nsAutoString title;
|
||||
mInputElement->GetAttr(kNameSpaceID_None, nsGkAtoms::title, title);
|
||||
if (title.IsEmpty()) {
|
||||
@ -295,7 +295,7 @@ InputType::GetValidationMessage(nsAString& aValidationMessage,
|
||||
}
|
||||
case nsIConstraintValidation::VALIDITY_STATE_RANGE_OVERFLOW:
|
||||
{
|
||||
nsXPIDLString message;
|
||||
nsAutoString message;
|
||||
rv = GetRangeOverflowMessage(message);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
@ -306,7 +306,7 @@ InputType::GetValidationMessage(nsAString& aValidationMessage,
|
||||
}
|
||||
case nsIConstraintValidation::VALIDITY_STATE_RANGE_UNDERFLOW:
|
||||
{
|
||||
nsXPIDLString message;
|
||||
nsAutoString message;
|
||||
rv = GetRangeUnderflowMessage(message);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
@ -317,7 +317,7 @@ InputType::GetValidationMessage(nsAString& aValidationMessage,
|
||||
}
|
||||
case nsIConstraintValidation::VALIDITY_STATE_STEP_MISMATCH:
|
||||
{
|
||||
nsXPIDLString message;
|
||||
nsAutoString message;
|
||||
|
||||
mozilla::Decimal value = mInputElement->GetValueAsDecimal();
|
||||
MOZ_ASSERT(!value.isNaN());
|
||||
@ -365,7 +365,7 @@ InputType::GetValidationMessage(nsAString& aValidationMessage,
|
||||
}
|
||||
case nsIConstraintValidation::VALIDITY_STATE_BAD_INPUT:
|
||||
{
|
||||
nsXPIDLString message;
|
||||
nsAutoString message;
|
||||
rv = GetBadInputMessage(message);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
@ -382,32 +382,32 @@ InputType::GetValidationMessage(nsAString& aValidationMessage,
|
||||
}
|
||||
|
||||
nsresult
|
||||
InputType::GetValueMissingMessage(nsXPIDLString& aMessage)
|
||||
InputType::GetValueMissingMessage(nsAString& aMessage)
|
||||
{
|
||||
return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"FormValidationValueMissing", aMessage);
|
||||
}
|
||||
|
||||
nsresult
|
||||
InputType::GetTypeMismatchMessage(nsXPIDLString& aMessage)
|
||||
InputType::GetTypeMismatchMessage(nsAString& aMessage)
|
||||
{
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
InputType::GetRangeOverflowMessage(nsXPIDLString& aMessage)
|
||||
InputType::GetRangeOverflowMessage(nsAString& aMessage)
|
||||
{
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
InputType::GetRangeUnderflowMessage(nsXPIDLString& aMessage)
|
||||
InputType::GetRangeUnderflowMessage(nsAString& aMessage)
|
||||
{
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
InputType::GetBadInputMessage(nsXPIDLString& aMessage)
|
||||
InputType::GetBadInputMessage(nsAString& aMessage)
|
||||
{
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
@ -63,11 +63,11 @@ public:
|
||||
|
||||
nsresult GetValidationMessage(nsAString& aValidationMessage,
|
||||
nsIConstraintValidation::ValidityStateType aType);
|
||||
virtual nsresult GetValueMissingMessage(nsXPIDLString& aMessage);
|
||||
virtual nsresult GetTypeMismatchMessage(nsXPIDLString& aMessage);
|
||||
virtual nsresult GetRangeOverflowMessage(nsXPIDLString& aMessage);
|
||||
virtual nsresult GetRangeUnderflowMessage(nsXPIDLString& aMessage);
|
||||
virtual nsresult GetBadInputMessage(nsXPIDLString& aMessage);
|
||||
virtual nsresult GetValueMissingMessage(nsAString& aMessage);
|
||||
virtual nsresult GetTypeMismatchMessage(nsAString& aMessage);
|
||||
virtual nsresult GetRangeOverflowMessage(nsAString& aMessage);
|
||||
virtual nsresult GetRangeUnderflowMessage(nsAString& aMessage);
|
||||
virtual nsresult GetBadInputMessage(nsAString& aMessage);
|
||||
|
||||
virtual nsresult MinMaxStepAttrChanged();
|
||||
|
||||
|
@ -65,7 +65,7 @@ NumericInputTypeBase::HasStepMismatch(bool aUseZeroIfValueNaN) const
|
||||
}
|
||||
|
||||
nsresult
|
||||
NumericInputTypeBase::GetRangeOverflowMessage(nsXPIDLString& aMessage)
|
||||
NumericInputTypeBase::GetRangeOverflowMessage(nsAString& aMessage)
|
||||
{
|
||||
// We want to show the value as parsed when it's a number
|
||||
mozilla::Decimal maximum = mInputElement->GetMaximum();
|
||||
@ -84,7 +84,7 @@ NumericInputTypeBase::GetRangeOverflowMessage(nsXPIDLString& aMessage)
|
||||
}
|
||||
|
||||
nsresult
|
||||
NumericInputTypeBase::GetRangeUnderflowMessage(nsXPIDLString& aMessage)
|
||||
NumericInputTypeBase::GetRangeUnderflowMessage(nsAString& aMessage)
|
||||
{
|
||||
mozilla::Decimal minimum = mInputElement->GetMinimum();
|
||||
MOZ_ASSERT(!minimum.isNaN());
|
||||
@ -167,14 +167,14 @@ NumberInputType::HasBadInput() const
|
||||
}
|
||||
|
||||
nsresult
|
||||
NumberInputType::GetValueMissingMessage(nsXPIDLString& aMessage)
|
||||
NumberInputType::GetValueMissingMessage(nsAString& aMessage)
|
||||
{
|
||||
return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"FormValidationBadInputNumber", aMessage);
|
||||
}
|
||||
|
||||
nsresult
|
||||
NumberInputType::GetBadInputMessage(nsXPIDLString& aMessage)
|
||||
NumberInputType::GetBadInputMessage(nsAString& aMessage)
|
||||
{
|
||||
return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"FormValidationBadInputNumber", aMessage);
|
||||
|
@ -18,8 +18,8 @@ public:
|
||||
bool IsRangeUnderflow() const override;
|
||||
bool HasStepMismatch(bool aUseZeroIfValueNaN) const override;
|
||||
|
||||
nsresult GetRangeOverflowMessage(nsXPIDLString& aMessage) override;
|
||||
nsresult GetRangeUnderflowMessage(nsXPIDLString& aMessage) override;
|
||||
nsresult GetRangeOverflowMessage(nsAString& aMessage) override;
|
||||
nsresult GetRangeUnderflowMessage(nsAString& aMessage) override;
|
||||
|
||||
bool ConvertStringToNumber(nsAString& aValue,
|
||||
mozilla::Decimal& aResultValue) const override;
|
||||
@ -45,8 +45,8 @@ public:
|
||||
bool IsValueMissing() const override;
|
||||
bool HasBadInput() const override;
|
||||
|
||||
nsresult GetValueMissingMessage(nsXPIDLString& aMessage) override;
|
||||
nsresult GetBadInputMessage(nsXPIDLString& aMessage) override;
|
||||
nsresult GetValueMissingMessage(nsAString& aMessage) override;
|
||||
nsresult GetBadInputMessage(nsAString& aMessage) override;
|
||||
|
||||
protected:
|
||||
bool IsMutable() const override;
|
||||
|
@ -121,7 +121,7 @@ URLInputType::HasTypeMismatch() const
|
||||
}
|
||||
|
||||
nsresult
|
||||
URLInputType::GetTypeMismatchMessage(nsXPIDLString& aMessage)
|
||||
URLInputType::GetTypeMismatchMessage(nsAString& aMessage)
|
||||
{
|
||||
return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"FormValidationInvalidURL",
|
||||
@ -165,7 +165,7 @@ EmailInputType::HasBadInput() const
|
||||
}
|
||||
|
||||
nsresult
|
||||
EmailInputType::GetTypeMismatchMessage(nsXPIDLString& aMessage)
|
||||
EmailInputType::GetTypeMismatchMessage(nsAString& aMessage)
|
||||
{
|
||||
return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"FormValidationInvalidEmail",
|
||||
@ -173,7 +173,7 @@ EmailInputType::GetTypeMismatchMessage(nsXPIDLString& aMessage)
|
||||
}
|
||||
|
||||
nsresult
|
||||
EmailInputType::GetBadInputMessage(nsXPIDLString& aMessage)
|
||||
EmailInputType::GetBadInputMessage(nsAString& aMessage)
|
||||
{
|
||||
return nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"FormValidationInvalidEmail",
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
|
||||
bool HasTypeMismatch() const override;
|
||||
|
||||
nsresult GetTypeMismatchMessage(nsXPIDLString& aMessage) override;
|
||||
nsresult GetTypeMismatchMessage(nsAString& aMessage) override;
|
||||
|
||||
private:
|
||||
explicit URLInputType(mozilla::dom::HTMLInputElement* aInputElement)
|
||||
@ -109,8 +109,8 @@ public:
|
||||
bool HasTypeMismatch() const override;
|
||||
bool HasBadInput() const override;
|
||||
|
||||
nsresult GetTypeMismatchMessage(nsXPIDLString& aMessage) override;
|
||||
nsresult GetBadInputMessage(nsXPIDLString& aMessage) override;
|
||||
nsresult GetTypeMismatchMessage(nsAString& aMessage) override;
|
||||
nsresult GetBadInputMessage(nsAString& aMessage) override;
|
||||
|
||||
private:
|
||||
explicit EmailInputType(mozilla::dom::HTMLInputElement* aInputElement)
|
||||
|
@ -808,9 +808,9 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
rv = bundleService->CreateBundle("chrome://global/locale/browser.properties",
|
||||
getter_AddRefs(bundle));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv) && bundle, "chrome://global/locale/browser.properties could not be loaded");
|
||||
nsXPIDLString title;
|
||||
nsAutoString title;
|
||||
if (bundle) {
|
||||
bundle->GetStringFromName("plainText.wordWrap", getter_Copies(title));
|
||||
bundle->GetStringFromName("plainText.wordWrap", title);
|
||||
}
|
||||
SetSelectedStyleSheetSet(title);
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(!aMessageName.IsEmpty());
|
||||
|
||||
nsXPIDLString localizedMessage;
|
||||
nsAutoString localizedMessage;
|
||||
if (NS_WARN_IF(NS_FAILED(
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
aMessageName.BeginReading(),
|
||||
|
@ -307,7 +307,7 @@ void InitBrandName()
|
||||
if (sBrandName) {
|
||||
return;
|
||||
}
|
||||
nsXPIDLString brandName;
|
||||
nsAutoString brandName;
|
||||
nsCOMPtr<nsIStringBundleService> stringBundleService =
|
||||
mozilla::services::GetStringBundleService();
|
||||
if (stringBundleService) {
|
||||
@ -315,8 +315,7 @@ void InitBrandName()
|
||||
nsresult rv = stringBundleService->CreateBundle(kBrandBundleURL,
|
||||
getter_AddRefs(brandBundle));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = brandBundle->GetStringFromName("brandShortName",
|
||||
getter_Copies(brandName));
|
||||
rv = brandBundle->GetStringFromName("brandShortName", brandName);
|
||||
NS_WARNING_ASSERTION(
|
||||
NS_SUCCEEDED(rv), "Could not get the program name for a cubeb stream.");
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ WebAudioUtils::LogToDeveloperConsole(uint64_t aWindowID, const char* aKey)
|
||||
return;
|
||||
}
|
||||
|
||||
nsXPIDLString result;
|
||||
nsAutoString result;
|
||||
rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
aKey, result);
|
||||
|
||||
|
@ -155,7 +155,7 @@ PluginHangUIParent::Init(const nsString& aPluginName)
|
||||
exePath = exePath.AppendASCII(MOZ_HANGUI_PROCESS_NAME);
|
||||
CommandLine commandLine(exePath.value());
|
||||
|
||||
nsXPIDLString localizedStr;
|
||||
nsAutoString localizedStr;
|
||||
const char16_t* formatParams[] = { aPluginName.get() };
|
||||
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"PluginHangUIMessage",
|
||||
|
@ -779,8 +779,8 @@ nsCSPContext::logToConsole(const char* aName,
|
||||
{
|
||||
// let's check if we have to queue up console messages
|
||||
if (mQueueUpMessages) {
|
||||
nsXPIDLString msg;
|
||||
CSP_GetLocalizedStr(aName, aParams, aParamsLength, getter_Copies(msg));
|
||||
nsAutoString msg;
|
||||
CSP_GetLocalizedStr(aName, aParams, aParamsLength, msg);
|
||||
ConsoleMsgQueueElem &elem = *mConsoleMsgQueue.AppendElement();
|
||||
elem.mMsg = msg;
|
||||
elem.mSourceName = PromiseFlatString(aSourceName);
|
||||
|
@ -91,7 +91,7 @@ void
|
||||
CSP_GetLocalizedStr(const char* aName,
|
||||
const char16_t** aParams,
|
||||
uint32_t aLength,
|
||||
char16_t** outResult)
|
||||
nsAString& outResult)
|
||||
{
|
||||
nsCOMPtr<nsIStringBundle> keyStringBundle;
|
||||
nsCOMPtr<nsIStringBundleService> stringBundleService =
|
||||
@ -193,8 +193,8 @@ CSP_LogLocalizedStr(const char* aName,
|
||||
const char* aCategory,
|
||||
uint64_t aInnerWindowID)
|
||||
{
|
||||
nsXPIDLString logMsg;
|
||||
CSP_GetLocalizedStr(aName, aParams, aLength, getter_Copies(logMsg));
|
||||
nsAutoString logMsg;
|
||||
CSP_GetLocalizedStr(aName, aParams, aLength, logMsg);
|
||||
CSP_LogMessage(logMsg, aSourceName, aSourceLine,
|
||||
aLineNumber, aColumnNumber, aFlags,
|
||||
aCategory, aInnerWindowID);
|
||||
|
@ -38,7 +38,7 @@ void CSP_LogLocalizedStr(const char* aName,
|
||||
void CSP_GetLocalizedStr(const char* aName,
|
||||
const char16_t** aParams,
|
||||
uint32_t aLength,
|
||||
char16_t** outResult);
|
||||
nsAString& outResult);
|
||||
|
||||
void CSP_LogStrMessage(const nsAString& aMsg);
|
||||
|
||||
|
@ -1228,13 +1228,14 @@ nsresult nsWebBrowserPersist::SendErrorStatusChange(
|
||||
rv = s->CreateBundle(kWebBrowserPersistStringBundle, getter_AddRefs(bundle));
|
||||
NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && bundle, NS_ERROR_FAILURE);
|
||||
|
||||
nsXPIDLString msgText;
|
||||
nsAutoString msgText;
|
||||
const char16_t *strings[1];
|
||||
strings[0] = path.get();
|
||||
rv = bundle->FormatStringFromName(msgId, strings, 1, getter_Copies(msgText));
|
||||
rv = bundle->FormatStringFromName(msgId, strings, 1, msgText);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
|
||||
mProgressListener->OnStatusChange(nullptr, aRequest, aResult, msgText);
|
||||
mProgressListener->OnStatusChange(nullptr, aRequest, aResult,
|
||||
msgText.get());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1884,7 +1884,7 @@ ServiceWorkerManager::LocalizeAndReportToAllClients(
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsXPIDLString message;
|
||||
nsAutoString message;
|
||||
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
aStringKey, aParamArray, message);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -401,7 +401,7 @@ ServiceWorkerUpdateJob::ComparisonResult(nsresult aStatus,
|
||||
}
|
||||
|
||||
if (!StringBeginsWith(mRegistration->mScope, maxPrefix)) {
|
||||
nsXPIDLString message;
|
||||
nsAutoString message;
|
||||
NS_ConvertUTF8toUTF16 reportScope(mRegistration->mScope);
|
||||
NS_ConvertUTF8toUTF16 reportMaxPrefix(maxPrefix);
|
||||
const char16_t* params[] = { reportScope.get(), reportMaxPrefix.get() };
|
||||
|
@ -1077,11 +1077,10 @@ txMozillaXSLTProcessor::reportError(nsresult aResult,
|
||||
nsCOMPtr<nsIStringBundleService> sbs =
|
||||
mozilla::services::GetStringBundleService();
|
||||
if (sbs) {
|
||||
nsXPIDLString errorText;
|
||||
sbs->FormatStatusMessage(aResult, EmptyString().get(),
|
||||
getter_Copies(errorText));
|
||||
nsAutoString errorText;
|
||||
sbs->FormatStatusMessage(aResult, EmptyString().get(), errorText);
|
||||
|
||||
nsXPIDLString errorMessage;
|
||||
nsAutoString errorMessage;
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
sbs->CreateBundle(XSLT_MSGS_URL, getter_AddRefs(bundle));
|
||||
|
||||
@ -1089,13 +1088,11 @@ txMozillaXSLTProcessor::reportError(nsresult aResult,
|
||||
const char16_t* error[] = { errorText.get() };
|
||||
if (mStylesheet) {
|
||||
bundle->FormatStringFromName("TransformError",
|
||||
error, 1,
|
||||
getter_Copies(errorMessage));
|
||||
error, 1, errorMessage);
|
||||
}
|
||||
else {
|
||||
bundle->FormatStringFromName("LoadingError",
|
||||
error, 1,
|
||||
getter_Copies(errorMessage));
|
||||
error, 1, errorMessage);
|
||||
}
|
||||
}
|
||||
mErrorText.Assign(errorMessage);
|
||||
|
@ -518,12 +518,12 @@ nsresult nsAutoConfig::PromptForEMailAddress(nsACString &emailAddress)
|
||||
getter_AddRefs(bundle));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsXPIDLString title;
|
||||
rv = bundle->GetStringFromName("emailPromptTitle", getter_Copies(title));
|
||||
nsAutoString title;
|
||||
rv = bundle->GetStringFromName("emailPromptTitle", title);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsXPIDLString err;
|
||||
rv = bundle->GetStringFromName("emailPromptMsg", getter_Copies(err));
|
||||
nsAutoString err;
|
||||
rv = bundle->GetStringFromName("emailPromptMsg", err);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
bool check = false;
|
||||
nsXPIDLString emailResult;
|
||||
|
@ -54,13 +54,13 @@ static void DisplayError(void)
|
||||
if (!bundle)
|
||||
return;
|
||||
|
||||
nsXPIDLString title;
|
||||
rv = bundle->GetStringFromName("readConfigTitle", getter_Copies(title));
|
||||
nsAutoString title;
|
||||
rv = bundle->GetStringFromName("readConfigTitle", title);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
nsXPIDLString err;
|
||||
rv = bundle->GetStringFromName("readConfigMsg", getter_Copies(err));
|
||||
nsAutoString err;
|
||||
rv = bundle->GetStringFromName("readConfigMsg", err);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
|
@ -543,6 +543,9 @@ public:
|
||||
void SetScaleHint(const gfx::IntSize& aScaleHint)
|
||||
{ mScaleHint = aScaleHint; }
|
||||
|
||||
const gfx::IntSize& GetScaleHint() const
|
||||
{ return mScaleHint; }
|
||||
|
||||
void SetImageFactory(ImageFactory *aFactory)
|
||||
{
|
||||
RecursiveMutexAutoLock lock(mRecursiveMutex);
|
||||
|
@ -320,13 +320,17 @@ WebRenderLayerManager::CreateImageKey(nsDisplayItem* aItem,
|
||||
LayoutDeviceRect::FromAppUnits(bounds, appUnitsPerDevPixel),
|
||||
PixelCastJustification::WebRenderHasUnitResolution);
|
||||
LayerRect scBounds(0, 0, rect.width, rect.height);
|
||||
MaybeIntSize scaleToSize;
|
||||
if (!aContainer->GetScaleHint().IsEmpty()) {
|
||||
scaleToSize = Some(aContainer->GetScaleHint());
|
||||
}
|
||||
imageData->CreateAsyncImageWebRenderCommands(aBuilder,
|
||||
aContainer,
|
||||
aSc,
|
||||
rect,
|
||||
scBounds,
|
||||
gfx::Matrix4x4(),
|
||||
Nothing(),
|
||||
scaleToSize,
|
||||
wr::ImageRendering::Auto,
|
||||
wr::MixBlendMode::Normal);
|
||||
return Nothing();
|
||||
@ -351,6 +355,11 @@ WebRenderLayerManager::PushImage(nsDisplayItem* aItem,
|
||||
{
|
||||
gfx::IntSize size;
|
||||
Maybe<wr::ImageKey> key = CreateImageKey(aItem, aContainer, aBuilder, aSc, size);
|
||||
if (aContainer->IsAsync()) {
|
||||
// Async ImageContainer does not create ImageKey, instead it uses Pipeline.
|
||||
MOZ_ASSERT(key.isNothing());
|
||||
return true;
|
||||
}
|
||||
if (!key) {
|
||||
return false;
|
||||
}
|
||||
|
@ -16,42 +16,35 @@
|
||||
|
||||
#define NS_STRINGBUNDLE_CONTRACTID "@mozilla.org/intl/stringbundle;1"
|
||||
|
||||
/**
|
||||
* observer needs to check if the bundle handle matches
|
||||
*/
|
||||
#define NS_STRBUNDLE_LOADED_TOPIC "strbundle-loaded"
|
||||
|
||||
%}
|
||||
|
||||
native nsStrBundleLoadedFunc(nsStrBundleLoadedFunc);
|
||||
|
||||
[scriptable, uuid(D85A17C2-AA7C-11d2-9B8C-00805F8A16D9)]
|
||||
interface nsIStringBundle : nsISupports
|
||||
{
|
||||
wstring GetStringFromID(in long aID);
|
||||
AString GetStringFromID(in long aID);
|
||||
|
||||
// This method is mostly used from JS, where AUTF8String is appropriate.
|
||||
[binaryname(GetStringFromAUTF8Name)]
|
||||
wstring GetStringFromName(in AUTF8String aName);
|
||||
AString GetStringFromName(in AUTF8String aName);
|
||||
|
||||
// This method is mostly used from C++, where |string| is appropriate because
|
||||
// the names are most often 8-bit string literals (normally ASCII, though
|
||||
// u8"foo" literals will also work).
|
||||
[noscript, binaryname(GetStringFromName)]
|
||||
wstring GetStringFromNameCpp(in string aName);
|
||||
AString GetStringFromNameCpp(in string aName);
|
||||
|
||||
// this is kind of like smprintf - except that you can
|
||||
// only pass it unicode strings, using the %S formatting character.
|
||||
// the id or name should refer to a string in the bundle that
|
||||
// uses %S.. do NOT try to use any other types.
|
||||
// this uses nsTextFormatter::smprintf to do the dirty work.
|
||||
wstring formatStringFromID(in long aID,
|
||||
AString formatStringFromID(in long aID,
|
||||
[array, size_is(length)] in wstring params,
|
||||
in unsigned long length);
|
||||
|
||||
// This method is mostly used from JS, where AUTF8String is appropriate.
|
||||
[binaryname(FormatStringFromAUTF8Name)]
|
||||
wstring formatStringFromName(in AUTF8String aName,
|
||||
AString formatStringFromName(in AUTF8String aName,
|
||||
[array, size_is(length)] in wstring params,
|
||||
in unsigned long length);
|
||||
|
||||
@ -59,7 +52,7 @@ interface nsIStringBundle : nsISupports
|
||||
// the names are most often 8-bit string literals (normally ASCII, though
|
||||
// u8"foo" literals will also work).
|
||||
[noscript, binaryname(FormatStringFromName)]
|
||||
wstring formatStringFromNameCpp(in string aName,
|
||||
AString formatStringFromNameCpp(in string aName,
|
||||
[array, size_is(length)] in wstring params,
|
||||
in unsigned long length);
|
||||
|
||||
@ -67,7 +60,6 @@ interface nsIStringBundle : nsISupports
|
||||
Implements nsISimpleEnumerator, replaces nsIEnumerator
|
||||
*/
|
||||
nsISimpleEnumerator getSimpleEnumeration();
|
||||
|
||||
};
|
||||
|
||||
[scriptable, uuid(D85A17C0-AA7C-11d2-9B8C-00805F8A16D9)]
|
||||
@ -84,7 +76,7 @@ interface nsIStringBundleService : nsISupports
|
||||
* can be separated by newline ('\n') characters.
|
||||
* @return the formatted message
|
||||
*/
|
||||
wstring formatStatusMessage(in nsresult aStatus, in wstring aStatusArg);
|
||||
AString formatStatusMessage(in nsresult aStatus, in wstring aStatusArg);
|
||||
|
||||
/**
|
||||
* flushes the string bundle cache - useful when the locale changes or
|
||||
|
@ -115,8 +115,23 @@ nsStringBundle::LoadProperties()
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStringBundle::GetStringFromNameHelper(const char* aName, nsAString& aResult)
|
||||
NS_IMETHODIMP
|
||||
nsStringBundle::GetStringFromID(int32_t aID, nsAString& aResult)
|
||||
{
|
||||
nsAutoCString idStr;
|
||||
idStr.AppendInt(aID, 10);
|
||||
return GetStringFromName(idStr.get(), aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStringBundle::GetStringFromAUTF8Name(const nsACString& aName,
|
||||
nsAString& aResult)
|
||||
{
|
||||
return GetStringFromName(PromiseFlatCString(aName).get(), aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStringBundle::GetStringFromName(const char* aName, nsAString& aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aName);
|
||||
|
||||
@ -133,47 +148,14 @@ nsStringBundle::GetStringFromNameHelper(const char* aName, nsAString& aResult)
|
||||
if (NS_SUCCEEDED(rv)) return rv;
|
||||
}
|
||||
|
||||
rv = mProps->GetStringProperty(nsDependentCString(aName), aResult);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStringBundle::GetStringFromID(int32_t aID, char16_t **aResult)
|
||||
{
|
||||
nsAutoCString idStr;
|
||||
idStr.AppendInt(aID, 10);
|
||||
return GetStringFromName(idStr.get(), aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStringBundle::GetStringFromAUTF8Name(const nsACString& aName,
|
||||
char16_t **aResult)
|
||||
{
|
||||
return GetStringFromName(PromiseFlatCString(aName).get(), aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStringBundle::GetStringFromName(const char* aName, char16_t** aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = nullptr;
|
||||
|
||||
nsAutoString tmpstr;
|
||||
nsresult rv = GetStringFromNameHelper(aName, tmpstr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*aResult = ToNewUnicode(tmpstr);
|
||||
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return NS_OK;
|
||||
return mProps->GetStringProperty(nsDependentCString(aName), aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStringBundle::FormatStringFromID(int32_t aID,
|
||||
const char16_t **aParams,
|
||||
uint32_t aLength,
|
||||
char16_t ** aResult)
|
||||
nsAString& aResult)
|
||||
{
|
||||
nsAutoCString idStr;
|
||||
idStr.AppendInt(aID, 10);
|
||||
@ -185,7 +167,7 @@ NS_IMETHODIMP
|
||||
nsStringBundle::FormatStringFromAUTF8Name(const nsACString& aName,
|
||||
const char16_t **aParams,
|
||||
uint32_t aLength,
|
||||
char16_t **aResult)
|
||||
nsAString& aResult)
|
||||
{
|
||||
return FormatStringFromName(PromiseFlatCString(aName).get(), aParams,
|
||||
aLength, aResult);
|
||||
@ -196,15 +178,12 @@ NS_IMETHODIMP
|
||||
nsStringBundle::FormatStringFromName(const char* aName,
|
||||
const char16_t** aParams,
|
||||
uint32_t aLength,
|
||||
char16_t** aResult)
|
||||
nsAString& aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
NS_ASSERTION(aParams && aLength, "FormatStringFromName() without format parameters: use GetStringFromName() instead");
|
||||
|
||||
*aResult = nullptr;
|
||||
|
||||
nsAutoString formatStr;
|
||||
nsresult rv = GetStringFromNameHelper(aName, formatStr);
|
||||
nsresult rv = GetStringFromName(aName, formatStr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return FormatString(formatStr.get(), aParams, aLength, aResult);
|
||||
@ -294,9 +273,8 @@ nsStringBundle::GetSimpleEnumeration(nsISimpleEnumerator** elements)
|
||||
nsresult
|
||||
nsStringBundle::FormatString(const char16_t *aFormatStr,
|
||||
const char16_t **aParams, uint32_t aLength,
|
||||
char16_t **aResult)
|
||||
nsAString& aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
NS_ENSURE_ARG(aLength <= 10); // enforce 10-parameter limit
|
||||
|
||||
// implementation note: you would think you could use vsmprintf
|
||||
@ -305,20 +283,19 @@ nsStringBundle::FormatString(const char16_t *aFormatStr,
|
||||
// Don't believe me? See:
|
||||
// http://www.eskimo.com/~scs/C-faq/q15.13.html
|
||||
// -alecf
|
||||
*aResult =
|
||||
nsTextFormatter::smprintf(aFormatStr,
|
||||
aLength >= 1 ? aParams[0] : nullptr,
|
||||
aLength >= 2 ? aParams[1] : nullptr,
|
||||
aLength >= 3 ? aParams[2] : nullptr,
|
||||
aLength >= 4 ? aParams[3] : nullptr,
|
||||
aLength >= 5 ? aParams[4] : nullptr,
|
||||
aLength >= 6 ? aParams[5] : nullptr,
|
||||
aLength >= 7 ? aParams[6] : nullptr,
|
||||
aLength >= 8 ? aParams[7] : nullptr,
|
||||
aLength >= 9 ? aParams[8] : nullptr,
|
||||
aLength >= 10 ? aParams[9] : nullptr);
|
||||
nsTextFormatter::ssprintf(aResult, aFormatStr,
|
||||
aLength >= 1 ? aParams[0] : nullptr,
|
||||
aLength >= 2 ? aParams[1] : nullptr,
|
||||
aLength >= 3 ? aParams[2] : nullptr,
|
||||
aLength >= 4 ? aParams[3] : nullptr,
|
||||
aLength >= 5 ? aParams[4] : nullptr,
|
||||
aLength >= 6 ? aParams[5] : nullptr,
|
||||
aLength >= 7 ? aParams[6] : nullptr,
|
||||
aLength >= 8 ? aParams[7] : nullptr,
|
||||
aLength >= 9 ? aParams[8] : nullptr,
|
||||
aLength >= 10 ? aParams[9] : nullptr);
|
||||
|
||||
return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsExtensibleStringBundle, nsIStringBundle)
|
||||
@ -373,21 +350,24 @@ nsExtensibleStringBundle::~nsExtensibleStringBundle()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsExtensibleStringBundle::GetStringFromID(int32_t aID, char16_t ** aResult)
|
||||
nsresult
|
||||
nsExtensibleStringBundle::GetStringFromID(int32_t aID, nsAString& aResult)
|
||||
{
|
||||
nsAutoCString idStr;
|
||||
idStr.AppendInt(aID, 10);
|
||||
return GetStringFromName(idStr.get(), aResult);
|
||||
}
|
||||
|
||||
nsresult nsExtensibleStringBundle::GetStringFromAUTF8Name(
|
||||
const nsACString& aName, char16_t ** aResult)
|
||||
nsresult
|
||||
nsExtensibleStringBundle::GetStringFromAUTF8Name(const nsACString& aName,
|
||||
nsAString& aResult)
|
||||
{
|
||||
return GetStringFromName(PromiseFlatCString(aName).get(), aResult);
|
||||
}
|
||||
|
||||
nsresult nsExtensibleStringBundle::GetStringFromName(const char* aName,
|
||||
char16_t** aResult)
|
||||
nsresult
|
||||
nsExtensibleStringBundle::GetStringFromName(const char* aName,
|
||||
nsAString& aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
const uint32_t size = mBundles.Count();
|
||||
@ -407,7 +387,7 @@ NS_IMETHODIMP
|
||||
nsExtensibleStringBundle::FormatStringFromID(int32_t aID,
|
||||
const char16_t ** aParams,
|
||||
uint32_t aLength,
|
||||
char16_t ** aResult)
|
||||
nsAString& aResult)
|
||||
{
|
||||
nsAutoCString idStr;
|
||||
idStr.AppendInt(aID, 10);
|
||||
@ -418,7 +398,7 @@ NS_IMETHODIMP
|
||||
nsExtensibleStringBundle::FormatStringFromAUTF8Name(const nsACString& aName,
|
||||
const char16_t ** aParams,
|
||||
uint32_t aLength,
|
||||
char16_t ** aResult)
|
||||
nsAString& aResult)
|
||||
{
|
||||
return FormatStringFromName(PromiseFlatCString(aName).get(),
|
||||
aParams, aLength, aResult);
|
||||
@ -428,15 +408,16 @@ NS_IMETHODIMP
|
||||
nsExtensibleStringBundle::FormatStringFromName(const char* aName,
|
||||
const char16_t** aParams,
|
||||
uint32_t aLength,
|
||||
char16_t** aResult)
|
||||
nsAString& aResult)
|
||||
{
|
||||
nsXPIDLString formatStr;
|
||||
nsAutoString formatStr;
|
||||
nsresult rv;
|
||||
rv = GetStringFromName(aName, getter_Copies(formatStr));
|
||||
rv = GetStringFromName(aName, formatStr);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return nsStringBundle::FormatString(formatStr, aParams, aLength, aResult);
|
||||
return nsStringBundle::FormatString(formatStr.get(), aParams, aLength,
|
||||
aResult);
|
||||
}
|
||||
|
||||
nsresult nsExtensibleStringBundle::GetSimpleEnumeration(nsISimpleEnumerator ** aResult)
|
||||
@ -635,7 +616,7 @@ nsStringBundleService::CreateExtensibleBundle(const char* aCategory,
|
||||
nsresult
|
||||
nsStringBundleService::FormatWithBundle(nsIStringBundle* bundle, nsresult aStatus,
|
||||
uint32_t argCount, char16_t** argArray,
|
||||
char16_t* *result)
|
||||
nsAString& result)
|
||||
{
|
||||
nsresult rv;
|
||||
nsXPIDLCString key;
|
||||
@ -661,7 +642,7 @@ nsStringBundleService::FormatWithBundle(nsIStringBundle* bundle, nsresult aStatu
|
||||
NS_IMETHODIMP
|
||||
nsStringBundleService::FormatStatusMessage(nsresult aStatus,
|
||||
const char16_t* aStatusArg,
|
||||
char16_t* *result)
|
||||
nsAString& result)
|
||||
{
|
||||
nsresult rv;
|
||||
uint32_t i, argCount = 0;
|
||||
@ -670,8 +651,7 @@ nsStringBundleService::FormatStatusMessage(nsresult aStatus,
|
||||
|
||||
// XXX hack for mailnews who has already formatted their messages:
|
||||
if (aStatus == NS_OK && aStatusArg) {
|
||||
*result = NS_strdup(aStatusArg);
|
||||
NS_ENSURE_TRUE(*result, NS_ERROR_OUT_OF_MEMORY);
|
||||
result.Assign(aStatusArg);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,6 @@ public:
|
||||
protected:
|
||||
virtual ~nsStringBundle();
|
||||
|
||||
nsresult GetStringFromNameHelper(const char* aName, nsAString& aResult);
|
||||
|
||||
nsresult GetCombinedEnumeration(nsIStringBundleOverride* aOverrideString,
|
||||
nsISimpleEnumerator** aResult);
|
||||
private:
|
||||
@ -44,7 +42,7 @@ private:
|
||||
public:
|
||||
static nsresult FormatString(const char16_t *formatStr,
|
||||
const char16_t **aParams, uint32_t aLength,
|
||||
char16_t **aResult);
|
||||
nsAString& aResult);
|
||||
};
|
||||
|
||||
class nsExtensibleStringBundle;
|
||||
|
@ -39,7 +39,7 @@ private:
|
||||
void getStringBundle(const char *aUrl, nsIStringBundle** aResult);
|
||||
nsresult FormatWithBundle(nsIStringBundle* bundle, nsresult aStatus,
|
||||
uint32_t argCount, char16_t** argArray,
|
||||
char16_t* *result);
|
||||
nsAString& result);
|
||||
|
||||
void flushBundleCache();
|
||||
|
||||
|
@ -1837,7 +1837,7 @@ nsCSSFrameConstructor::CreateGeneratedContent(nsFrameConstructorState& aState,
|
||||
return content.forget();
|
||||
}
|
||||
|
||||
nsXPIDLString temp;
|
||||
nsAutoString temp;
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
|
||||
"Submit", temp);
|
||||
return CreateGenConTextNode(aState, temp, nullptr, nullptr);
|
||||
@ -9129,9 +9129,9 @@ nsCSSFrameConstructor::WillDestroyFrameTree()
|
||||
// XXXbz I'd really like this method to go away. Once we have inline-block and
|
||||
// I can just use that for sized broken images, that can happen, maybe.
|
||||
void
|
||||
nsCSSFrameConstructor::GetAlternateTextFor(nsIContent* aContent,
|
||||
nsIAtom* aTag,
|
||||
nsXPIDLString& aAltText)
|
||||
nsCSSFrameConstructor::GetAlternateTextFor(nsIContent* aContent,
|
||||
nsIAtom* aTag,
|
||||
nsAString& aAltText)
|
||||
{
|
||||
// The "alt" attribute specifies alternate text that is rendered
|
||||
// when the image can not be displayed.
|
||||
|
@ -65,9 +65,9 @@ public:
|
||||
}
|
||||
|
||||
// get the alternate text for a content node
|
||||
static void GetAlternateTextFor(nsIContent* aContent,
|
||||
nsIAtom* aTag, // content object's tag
|
||||
nsXPIDLString& aAltText);
|
||||
static void GetAlternateTextFor(nsIContent* aContent,
|
||||
nsIAtom* aTag, // content object's tag
|
||||
nsAString& aAltText);
|
||||
|
||||
private:
|
||||
nsCSSFrameConstructor(const nsCSSFrameConstructor& aCopy) = delete;
|
||||
|
@ -1268,7 +1268,7 @@ nsDocumentViewer::PermitUnloadInternal(bool *aShouldPrompt,
|
||||
isTabModalPromptAllowed);
|
||||
}
|
||||
|
||||
nsXPIDLString title, message, stayLabel, leaveLabel;
|
||||
nsAutoString title, message, stayLabel, leaveLabel;
|
||||
rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"OnBeforeUnloadTitle",
|
||||
title);
|
||||
@ -1291,7 +1291,7 @@ nsDocumentViewer::PermitUnloadInternal(bool *aShouldPrompt,
|
||||
rv = tmp;
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv) || !title || !message || !stayLabel || !leaveLabel) {
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Failed to get strings from dom.properties!");
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1307,9 +1307,9 @@ nsDocumentViewer::PermitUnloadInternal(bool *aShouldPrompt,
|
||||
nsAutoSyncOperation sync(mDocument);
|
||||
mInPermitUnloadPrompt = true;
|
||||
mozilla::Telemetry::Accumulate(mozilla::Telemetry::ONBEFOREUNLOAD_PROMPT_COUNT, 1);
|
||||
rv = prompt->ConfirmEx(title, message, buttonFlags,
|
||||
leaveLabel, stayLabel, nullptr, nullptr,
|
||||
&dummy, &buttonPressed);
|
||||
rv = prompt->ConfirmEx(title.get(), message.get(), buttonFlags,
|
||||
leaveLabel.get(), stayLabel.get(),
|
||||
nullptr, nullptr, &dummy, &buttonPressed);
|
||||
mInPermitUnloadPrompt = false;
|
||||
|
||||
// If the prompt aborted, we tell our consumer that it is not allowed
|
||||
|
@ -88,7 +88,7 @@ MakeAnonButton(nsIDocument* aDoc, const char* labelKey,
|
||||
NS_LITERAL_STRING("button"), false);
|
||||
|
||||
// Set the file picking button text depending on the current locale.
|
||||
nsXPIDLString buttonTxt;
|
||||
nsAutoString buttonTxt;
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
|
||||
labelKey, buttonTxt);
|
||||
|
||||
|
@ -105,7 +105,7 @@ DetailsFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
mDefaultSummary = new HTMLSummaryElement(nodeInfo);
|
||||
|
||||
nsXPIDLString defaultSummaryText;
|
||||
nsAutoString defaultSummaryText;
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
|
||||
"DefaultSummary", defaultSummaryText);
|
||||
RefPtr<nsTextNode> description = new nsTextNode(nodeInfoManager);
|
||||
|
@ -1498,7 +1498,7 @@ nsImageFrame::DisplayAltFeedback(gfxContext& aRenderingContext,
|
||||
if (!inner.IsEmpty()) {
|
||||
nsIContent* content = GetContent();
|
||||
if (content) {
|
||||
nsXPIDLString altText;
|
||||
nsAutoString altText;
|
||||
nsCSSFrameConstructor::GetAlternateTextFor(content,
|
||||
content->NodeInfo()->NameAtom(),
|
||||
altText);
|
||||
|
@ -393,7 +393,7 @@ void
|
||||
nsSimplePageSequenceFrame::SetPageNumberFormat(const char* aPropName, const char* aDefPropVal, bool aPageNumOnly)
|
||||
{
|
||||
// Doing this here so we only have to go get these formats once
|
||||
nsXPIDLString pageNumberFormat;
|
||||
nsAutoString pageNumberFormat;
|
||||
// Now go get the Localized Page Formating String
|
||||
nsresult rv =
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::ePRINTING_PROPERTIES,
|
||||
|
@ -41,7 +41,6 @@ nsPrintData::nsPrintData(ePrintDataType aType)
|
||||
, mShrinkRatio(1.0)
|
||||
, mOrigDCScale(1.0)
|
||||
, mPPEventListeners(nullptr)
|
||||
, mBrandName(nullptr)
|
||||
{
|
||||
nsCOMPtr<nsIStringBundle> brandBundle;
|
||||
nsCOMPtr<nsIStringBundleService> svc =
|
||||
@ -49,14 +48,13 @@ nsPrintData::nsPrintData(ePrintDataType aType)
|
||||
if (svc) {
|
||||
svc->CreateBundle( "chrome://branding/locale/brand.properties", getter_AddRefs( brandBundle ) );
|
||||
if (brandBundle) {
|
||||
brandBundle->GetStringFromName("brandShortName", &mBrandName );
|
||||
brandBundle->GetStringFromName("brandShortName", mBrandName);
|
||||
}
|
||||
}
|
||||
|
||||
if (!mBrandName) {
|
||||
mBrandName = ToNewUnicode(NS_LITERAL_STRING("Mozilla Document"));
|
||||
if (mBrandName.IsEmpty()) {
|
||||
mBrandName.AssignLiteral(u"Mozilla Document");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
nsPrintData::~nsPrintData()
|
||||
@ -91,10 +89,6 @@ nsPrintData::~nsPrintData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mBrandName) {
|
||||
free(mBrandName);
|
||||
}
|
||||
}
|
||||
|
||||
void nsPrintData::OnStartPrinting()
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
||||
nsPrintPreviewListener* mPPEventListeners;
|
||||
|
||||
char16_t* mBrandName; // needed as a substitute name for a document
|
||||
nsString mBrandName; // needed as a substitute name for a document
|
||||
|
||||
private:
|
||||
nsPrintData() = delete;
|
||||
|
@ -1508,7 +1508,7 @@ nsPrintEngine::GetDisplayTitleAndURL(const UniquePtr<nsPrintObject>& aPO,
|
||||
if (aDefType == eDocTitleDefURLDoc) {
|
||||
if (!aURLStr.IsEmpty()) {
|
||||
aTitle = aURLStr;
|
||||
} else if (mPrt->mBrandName) {
|
||||
} else if (!mPrt->mBrandName.IsEmpty()) {
|
||||
aTitle = mPrt->mBrandName;
|
||||
}
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ ErrorReporter::ReportUnexpected(const char *aMessage)
|
||||
if (!ShouldReportErrors()) return;
|
||||
|
||||
nsAutoString str;
|
||||
sStringBundle->GetStringFromName(aMessage, getter_Copies(str));
|
||||
sStringBundle->GetStringFromName(aMessage, str);
|
||||
AddToError(str);
|
||||
}
|
||||
|
||||
@ -330,9 +330,8 @@ ErrorReporter::ReportUnexpected(const char *aMessage,
|
||||
const char16_t *params[1] = { qparam.get() };
|
||||
|
||||
nsAutoString str;
|
||||
sStringBundle->FormatStringFromName(aMessage,
|
||||
params, ArrayLength(params),
|
||||
getter_Copies(str));
|
||||
sStringBundle->FormatStringFromName(aMessage, params, ArrayLength(params),
|
||||
str);
|
||||
AddToError(str);
|
||||
}
|
||||
|
||||
@ -345,9 +344,8 @@ ErrorReporter::ReportUnexpectedUnescaped(const char *aMessage,
|
||||
const char16_t *params[1] = { aParam.get() };
|
||||
|
||||
nsAutoString str;
|
||||
sStringBundle->FormatStringFromName(aMessage,
|
||||
params, ArrayLength(params),
|
||||
getter_Copies(str));
|
||||
sStringBundle->FormatStringFromName(aMessage, params, ArrayLength(params),
|
||||
str);
|
||||
AddToError(str);
|
||||
}
|
||||
|
||||
@ -375,9 +373,8 @@ ErrorReporter::ReportUnexpected(const char *aMessage,
|
||||
const char16_t *params[2] = { tokenString.get(), charStr };
|
||||
|
||||
nsAutoString str;
|
||||
sStringBundle->FormatStringFromName(aMessage,
|
||||
params, ArrayLength(params),
|
||||
getter_Copies(str));
|
||||
sStringBundle->FormatStringFromName(aMessage, params, ArrayLength(params),
|
||||
str);
|
||||
AddToError(str);
|
||||
}
|
||||
|
||||
@ -393,9 +390,8 @@ ErrorReporter::ReportUnexpected(const char *aMessage,
|
||||
const char16_t *params[2] = { qparam.get(), aValue.get() };
|
||||
|
||||
nsAutoString str;
|
||||
sStringBundle->FormatStringFromName(aMessage,
|
||||
params, ArrayLength(params),
|
||||
getter_Copies(str));
|
||||
sStringBundle->FormatStringFromName(aMessage, params, ArrayLength(params),
|
||||
str);
|
||||
AddToError(str);
|
||||
}
|
||||
|
||||
@ -405,13 +401,12 @@ ErrorReporter::ReportUnexpectedEOF(const char *aMessage)
|
||||
if (!ShouldReportErrors()) return;
|
||||
|
||||
nsAutoString innerStr;
|
||||
sStringBundle->GetStringFromName(aMessage, getter_Copies(innerStr));
|
||||
sStringBundle->GetStringFromName(aMessage, innerStr);
|
||||
const char16_t *params[1] = { innerStr.get() };
|
||||
|
||||
nsAutoString str;
|
||||
sStringBundle->FormatStringFromName("PEUnexpEOF2",
|
||||
params, ArrayLength(params),
|
||||
getter_Copies(str));
|
||||
sStringBundle->FormatStringFromName("PEUnexpEOF2", params,
|
||||
ArrayLength(params), str);
|
||||
AddToError(str);
|
||||
}
|
||||
|
||||
@ -426,9 +421,8 @@ ErrorReporter::ReportUnexpectedEOF(char16_t aExpected)
|
||||
const char16_t *params[1] = { expectedStr };
|
||||
|
||||
nsAutoString str;
|
||||
sStringBundle->FormatStringFromName("PEUnexpEOF2",
|
||||
params, ArrayLength(params),
|
||||
getter_Copies(str));
|
||||
sStringBundle->FormatStringFromName("PEUnexpEOF2", params,
|
||||
ArrayLength(params), str);
|
||||
AddToError(str);
|
||||
}
|
||||
|
||||
|
@ -1102,11 +1102,12 @@ nsMenuFrame::BuildAcceleratorText(bool aNotify)
|
||||
getter_AddRefs(bundle));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && bundle) {
|
||||
nsXPIDLString keyName;
|
||||
nsAutoString keyName;
|
||||
rv = bundle->GetStringFromName(NS_ConvertUTF16toUTF8(keyCode).get(),
|
||||
getter_Copies(keyName));
|
||||
if (keyName)
|
||||
keyName);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
accelString = keyName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -325,8 +325,8 @@ NS_IMETHODIMP nsPrefBranch::GetComplexValue(const char *aPrefName, const nsIID &
|
||||
// if we need to fetch the default value, do that instead, otherwise use the
|
||||
// value we pulled in at the top of this function
|
||||
if (bNeedDefault) {
|
||||
nsXPIDLString utf16String;
|
||||
rv = GetDefaultFromPropertiesFile(pref.get(), getter_Copies(utf16String));
|
||||
nsAutoString utf16String;
|
||||
rv = GetDefaultFromPropertiesFile(pref.get(), utf16String);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
theString->SetData(utf16String.get());
|
||||
}
|
||||
@ -836,7 +836,9 @@ nsPrefBranch::RemoveExpiredCallback(PrefCallback *aCallback)
|
||||
mObservers.Remove(aCallback);
|
||||
}
|
||||
|
||||
nsresult nsPrefBranch::GetDefaultFromPropertiesFile(const char *aPrefName, char16_t **return_buf)
|
||||
nsresult
|
||||
nsPrefBranch::GetDefaultFromPropertiesFile(const char *aPrefName,
|
||||
nsAString& aReturn)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -858,7 +860,7 @@ nsresult nsPrefBranch::GetDefaultFromPropertiesFile(const char *aPrefName, char1
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return bundle->GetStringFromName(aPrefName, return_buf);
|
||||
return bundle->GetStringFromName(aPrefName, aReturn);
|
||||
}
|
||||
|
||||
nsPrefBranch::PrefName
|
||||
|
@ -242,7 +242,7 @@ protected:
|
||||
|
||||
virtual ~nsPrefBranch();
|
||||
|
||||
nsresult GetDefaultFromPropertiesFile(const char *aPrefName, char16_t **return_buf);
|
||||
nsresult GetDefaultFromPropertiesFile(const char *aPrefName, nsAString& aReturn);
|
||||
// As SetCharPref, but without any check on the length of |aValue|
|
||||
nsresult SetCharPrefInternal(const char *aPrefName, const char *aValue);
|
||||
// Reject strings that are more than 1Mb, warn if strings are more than 16kb
|
||||
|
@ -943,10 +943,10 @@ nsFtpState::R_syst() {
|
||||
char16_t* ucs2Response = ToNewUnicode(mResponseMsg);
|
||||
const char16_t *formatStrings[1] = { ucs2Response };
|
||||
|
||||
nsXPIDLString formattedString;
|
||||
nsAutoString formattedString;
|
||||
rv = bundle->FormatStringFromName("UnsupportedFTPServer",
|
||||
formatStrings, 1,
|
||||
getter_Copies(formattedString));
|
||||
formattedString);
|
||||
free(ucs2Response);
|
||||
if (NS_FAILED(rv))
|
||||
return FTP_ERROR;
|
||||
|
@ -828,17 +828,17 @@ mount_operation_ask_password (GMountOperation *mount_op,
|
||||
if (!realm.IsEmpty()) {
|
||||
const char16_t *strings[] = { realm.get(), dispHost.get() };
|
||||
bundle->FormatStringFromName("EnterLoginForRealm3",
|
||||
strings, 2, getter_Copies(nsmessage));
|
||||
strings, 2, nsmessage);
|
||||
} else {
|
||||
const char16_t *strings[] = { dispHost.get() };
|
||||
bundle->FormatStringFromName("EnterUserPasswordFor2",
|
||||
strings, 1, getter_Copies(nsmessage));
|
||||
strings, 1, nsmessage);
|
||||
}
|
||||
} else {
|
||||
NS_ConvertUTF8toUTF16 userName(default_user);
|
||||
const char16_t *strings[] = { userName.get(), dispHost.get() };
|
||||
bundle->FormatStringFromName("EnterPasswordFor",
|
||||
strings, 2, getter_Copies(nsmessage));
|
||||
strings, 2, nsmessage);
|
||||
}
|
||||
} else {
|
||||
g_warning("Unknown mount operation request (flags: %x)", flags);
|
||||
|
@ -2487,7 +2487,7 @@ HttpBaseChannel::AddSecurityMessage(const nsAString &aMessageTag,
|
||||
|
||||
auto innerWindowID = loadInfo->GetInnerWindowID();
|
||||
|
||||
nsXPIDLString errorText;
|
||||
nsAutoString errorText;
|
||||
rv = nsContentUtils::GetLocalizedString(
|
||||
nsContentUtils::eSECURITY_PROPERTIES,
|
||||
NS_ConvertUTF16toUTF8(aMessageTag).get(),
|
||||
|
@ -72,7 +72,7 @@ LogBlockedRequest(nsIRequest* aRequest,
|
||||
}
|
||||
|
||||
// Generate the error message
|
||||
nsXPIDLString blockedMessage;
|
||||
nsAutoString blockedMessage;
|
||||
NS_ConvertUTF8toUTF16 specUTF16(spec);
|
||||
const char16_t* params[] = { specUTF16.get(), aParam };
|
||||
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eSECURITY_PROPERTIES,
|
||||
|
@ -2809,11 +2809,9 @@ nsHttpChannel::PromptTempRedirect()
|
||||
rv = bundleService->CreateBundle(NECKO_MSGS_URL, getter_AddRefs(stringBundle));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLString messageString;
|
||||
rv = stringBundle->GetStringFromName("RepostFormData",
|
||||
getter_Copies(messageString));
|
||||
// GetStringFromName can return NS_OK and nullptr messageString.
|
||||
if (NS_SUCCEEDED(rv) && messageString) {
|
||||
nsAutoString messageString;
|
||||
rv = stringBundle->GetStringFromName("RepostFormData", messageString);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
bool repost = false;
|
||||
|
||||
nsCOMPtr<nsIPrompt> prompt;
|
||||
@ -2821,7 +2819,7 @@ nsHttpChannel::PromptTempRedirect()
|
||||
if (!prompt)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
prompt->Confirm(nullptr, messageString, &repost);
|
||||
prompt->Confirm(nullptr, messageString.get(), &repost);
|
||||
if (!repost)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -1586,9 +1586,9 @@ nsHttpChannelAuthProvider::ConfirmAuth(const char* bundleKey,
|
||||
|
||||
const char16_t *strs[2] = { ucsHost.get(), ucsUser.get() };
|
||||
|
||||
nsXPIDLString msg;
|
||||
bundle->FormatStringFromName(bundleKey, strs, 2, getter_Copies(msg));
|
||||
if (!msg)
|
||||
nsAutoString msg;
|
||||
rv = bundle->FormatStringFromName(bundleKey, strs, 2, msg);
|
||||
if (NS_FAILED(rv))
|
||||
return true;
|
||||
|
||||
nsCOMPtr<nsIInterfaceRequestor> callbacks;
|
||||
@ -1614,7 +1614,7 @@ nsHttpChannelAuthProvider::ConfirmAuth(const char* bundleKey,
|
||||
if (doYesNoPrompt) {
|
||||
int32_t choice;
|
||||
bool checkState = false;
|
||||
rv = prompt->ConfirmEx(nullptr, msg,
|
||||
rv = prompt->ConfirmEx(nullptr, msg.get(),
|
||||
nsIPrompt::BUTTON_POS_1_DEFAULT +
|
||||
nsIPrompt::STD_YES_NO_BUTTONS,
|
||||
nullptr, nullptr, nullptr, nullptr,
|
||||
@ -1625,7 +1625,7 @@ nsHttpChannelAuthProvider::ConfirmAuth(const char* bundleKey,
|
||||
confirmed = choice == 0;
|
||||
}
|
||||
else {
|
||||
rv = prompt->Confirm(nullptr, msg, &confirmed);
|
||||
rv = prompt->Confirm(nullptr, msg.get(), &confirmed);
|
||||
if (NS_FAILED(rv))
|
||||
return true;
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
|
||||
htmlEscSpec.Adopt(nsEscapeHTML2(unEscapeSpec.get(),
|
||||
unEscapeSpec.Length()));
|
||||
|
||||
nsXPIDLString title;
|
||||
nsAutoString title;
|
||||
const char16_t* formatTitle[] = {
|
||||
htmlEscSpec.get()
|
||||
};
|
||||
@ -523,7 +523,7 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
|
||||
rv = mBundle->FormatStringFromName("DirTitle",
|
||||
formatTitle,
|
||||
sizeof(formatTitle)/sizeof(char16_t*),
|
||||
getter_Copies(title));
|
||||
title);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// we want to convert string bundle to NCR
|
||||
@ -576,16 +576,15 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
|
||||
rv = mBundle->FormatStringFromName("DirTitle",
|
||||
formatHeading,
|
||||
sizeof(formatHeading)/sizeof(char16_t*),
|
||||
getter_Copies(title));
|
||||
title);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
AppendNonAsciiToNCR(title, buffer);
|
||||
buffer.AppendLiteral("</h1>\n");
|
||||
|
||||
if (!parentStr.IsEmpty()) {
|
||||
nsXPIDLString parentText;
|
||||
rv = mBundle->GetStringFromName("DirGoUp",
|
||||
getter_Copies(parentText));
|
||||
nsAutoString parentText;
|
||||
rv = mBundle->GetStringFromName("DirGoUp", parentText);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
buffer.AppendLiteral("<p id=\"UI_goUp\"><a class=\"up\" href=\"");
|
||||
@ -599,9 +598,8 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
|
||||
}
|
||||
|
||||
if (isSchemeFile) {
|
||||
nsXPIDLString showHiddenText;
|
||||
rv = mBundle->GetStringFromName("ShowHidden",
|
||||
getter_Copies(showHiddenText));
|
||||
nsAutoString showHiddenText;
|
||||
rv = mBundle->GetStringFromName("ShowHidden", showHiddenText);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
buffer.AppendLiteral("<p id=\"UI_showHidden\" style=\"display:none\"><label><input type=\"checkbox\" checked onchange=\"updateHidden()\">");
|
||||
@ -609,30 +607,25 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
|
||||
buffer.AppendLiteral("</label></p>\n");
|
||||
}
|
||||
|
||||
buffer.AppendLiteral("<table>\n");
|
||||
|
||||
nsXPIDLString columnText;
|
||||
|
||||
buffer.AppendLiteral(" <thead>\n"
|
||||
buffer.AppendLiteral("<table>\n"
|
||||
" <thead>\n"
|
||||
" <tr>\n"
|
||||
" <th>");
|
||||
|
||||
rv = mBundle->GetStringFromName("DirColName",
|
||||
getter_Copies(columnText));
|
||||
nsAutoString columnText;
|
||||
rv = mBundle->GetStringFromName("DirColName", columnText);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
AppendNonAsciiToNCR(columnText, buffer);
|
||||
buffer.AppendLiteral("</th>\n"
|
||||
" <th>");
|
||||
|
||||
rv = mBundle->GetStringFromName("DirColSize",
|
||||
getter_Copies(columnText));
|
||||
rv = mBundle->GetStringFromName("DirColSize", columnText);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
AppendNonAsciiToNCR(columnText, buffer);
|
||||
buffer.AppendLiteral("</th>\n"
|
||||
" <th colspan=\"2\">");
|
||||
|
||||
rv = mBundle->GetStringFromName("DirColMTime",
|
||||
getter_Copies(columnText));
|
||||
rv = mBundle->GetStringFromName("DirColMTime", columnText);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
AppendNonAsciiToNCR(columnText, buffer);
|
||||
buffer.AppendLiteral("</th>\n"
|
||||
@ -792,9 +785,8 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest,
|
||||
}
|
||||
pushBuffer.AppendLiteral("?size=16\" alt=\"");
|
||||
|
||||
nsXPIDLString altText;
|
||||
rv = mBundle->GetStringFromName("DirFileLabel",
|
||||
getter_Copies(altText));
|
||||
nsAutoString altText;
|
||||
rv = mBundle->GetStringFromName("DirFileLabel", altText);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
AppendNonAsciiToNCR(altText, pushBuffer);
|
||||
pushBuffer.AppendLiteral("\">");
|
||||
|
@ -32,9 +32,9 @@ nsHtml5PlainTextUtils::NewLinkAttributes()
|
||||
rv = bundleService->CreateBundle("chrome://global/locale/browser.properties",
|
||||
getter_AddRefs(bundle));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv) && bundle, "chrome://global/locale/browser.properties could not be loaded");
|
||||
nsXPIDLString title;
|
||||
nsAutoString title;
|
||||
if (bundle) {
|
||||
bundle->GetStringFromName("plainText.wordWrap", getter_Copies(title));
|
||||
bundle->GetStringFromName("plainText.wordWrap", title);
|
||||
}
|
||||
|
||||
linkAttrs->addAttribute(
|
||||
|
@ -932,7 +932,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsXPIDLString message;
|
||||
nsAutoString message;
|
||||
if (otherAtom) {
|
||||
const char16_t* params[] = { atom->GetUTF16String(),
|
||||
otherAtom->GetUTF16String() };
|
||||
|
@ -35,9 +35,9 @@ nsParserMsgUtils::GetLocalizedStringByName(const char * aPropFileName, const cha
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
nsresult rv = GetBundle(aPropFileName,getter_AddRefs(bundle));
|
||||
if (NS_SUCCEEDED(rv) && bundle) {
|
||||
nsXPIDLString valUni;
|
||||
rv = bundle->GetStringFromName(aKey, getter_Copies(valUni));
|
||||
if (NS_SUCCEEDED(rv) && valUni) {
|
||||
nsAutoString valUni;
|
||||
rv = bundle->GetStringFromName(aKey, valUni);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
oVal.Assign(valUni);
|
||||
}
|
||||
}
|
||||
@ -53,11 +53,11 @@ nsParserMsgUtils::GetLocalizedStringByID(const char * aPropFileName, uint32_t aI
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
nsresult rv = GetBundle(aPropFileName,getter_AddRefs(bundle));
|
||||
if (NS_SUCCEEDED(rv) && bundle) {
|
||||
nsXPIDLString valUni;
|
||||
rv = bundle->GetStringFromID(aID, getter_Copies(valUni));
|
||||
if (NS_SUCCEEDED(rv) && valUni) {
|
||||
nsAutoString valUni;
|
||||
rv = bundle->GetStringFromID(aID, valUni);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
oVal.Assign(valUni);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -320,7 +320,7 @@ nsNSSDialogs::GetPKCS12FilePassword(nsIInterfaceRequestor* ctx,
|
||||
|
||||
nsAutoString msg;
|
||||
nsresult rv = mPIPStringBundle->GetStringFromName(
|
||||
"getPKCS12FilePasswordMessage", getter_Copies(msg));
|
||||
"getPKCS12FilePasswordMessage", msg);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ NSSErrorsService::GetErrorMessage(nsresult aXPCOMErrorCode, nsAString &aErrorMes
|
||||
}
|
||||
|
||||
nsAutoString msg;
|
||||
nsresult rv = theBundle->GetStringFromName(id_str, getter_Copies(msg));
|
||||
nsresult rv = theBundle->GetStringFromName(id_str, msg);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aErrorMessage = msg;
|
||||
}
|
||||
|
@ -106,8 +106,7 @@ GetPIPNSSBundleString(const char* stringName, nsAString& result)
|
||||
return rv;
|
||||
}
|
||||
result.Truncate();
|
||||
return pipnssBundle->GetStringFromName(stringName,
|
||||
getter_Copies(result));
|
||||
return pipnssBundle->GetStringFromName(stringName, result);
|
||||
}
|
||||
|
||||
static nsresult
|
||||
@ -126,7 +125,7 @@ PIPBundleFormatStringFromName(const char* stringName, const char16_t** params,
|
||||
}
|
||||
result.Truncate();
|
||||
return pipnssBundle->FormatStringFromName(
|
||||
stringName, params, numParams, getter_Copies(result));
|
||||
stringName, params, numParams, result);
|
||||
}
|
||||
|
||||
static nsresult
|
||||
|
@ -238,10 +238,8 @@ nsNSSComponent::PIPBundleFormatStringFromName(const char* name,
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
if (mPIPNSSBundle && name) {
|
||||
nsXPIDLString result;
|
||||
rv = mPIPNSSBundle->FormatStringFromName(name,
|
||||
params, numParams,
|
||||
getter_Copies(result));
|
||||
nsAutoString result;
|
||||
rv = mPIPNSSBundle->FormatStringFromName(name, params, numParams, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
outString = result;
|
||||
}
|
||||
@ -257,8 +255,8 @@ nsNSSComponent::GetPIPNSSBundleString(const char* name, nsAString& outString)
|
||||
|
||||
outString.SetLength(0);
|
||||
if (mPIPNSSBundle && name) {
|
||||
nsXPIDLString result;
|
||||
rv = mPIPNSSBundle->GetStringFromName(name, getter_Copies(result));
|
||||
nsAutoString result;
|
||||
rv = mPIPNSSBundle->GetStringFromName(name, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
outString = result;
|
||||
rv = NS_OK;
|
||||
@ -276,8 +274,8 @@ nsNSSComponent::GetNSSBundleString(const char* name, nsAString& outString)
|
||||
|
||||
outString.SetLength(0);
|
||||
if (mNSSErrorsBundle && name) {
|
||||
nsXPIDLString result;
|
||||
rv = mNSSErrorsBundle->GetStringFromName(name, getter_Copies(result));
|
||||
nsAutoString result;
|
||||
rv = mNSSErrorsBundle->GetStringFromName(name, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
outString = result;
|
||||
rv = NS_OK;
|
||||
|
@ -12,10 +12,6 @@
|
||||
expected: FAIL
|
||||
bug: 660660
|
||||
|
||||
[Node member must be nuked: rootNode]
|
||||
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1303802
|
||||
bug: 1269155
|
||||
|
||||
[Historical DOM features must be removed: async]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -117,8 +117,8 @@ nsDownloadManager::GetDefaultDownloadsDirectory(nsIFile **aResult)
|
||||
// Linux:
|
||||
// XDG user dir spec, with a fallback to Home/Downloads
|
||||
|
||||
nsXPIDLString folderName;
|
||||
mBundle->GetStringFromName("downloadsFolder", getter_Copies(folderName));
|
||||
nsAutoString folderName;
|
||||
mBundle->GetStringFromName("downloadsFolder", folderName);
|
||||
|
||||
#if defined (XP_MACOSX)
|
||||
rv = dirService->Get(NS_OSX_DEFAULT_DOWNLOAD_DIR,
|
||||
|
@ -222,7 +222,7 @@ SetJournalMode(nsCOMPtr<mozIStorageConnection>& aDBConn,
|
||||
nsresult
|
||||
CreateRoot(nsCOMPtr<mozIStorageConnection>& aDBConn,
|
||||
const nsCString& aRootName, const nsCString& aGuid,
|
||||
const nsXPIDLString& titleString)
|
||||
const nsAString& titleString)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -1220,36 +1220,32 @@ Database::CreateBookmarkRoots()
|
||||
nsresult rv = bundleService->CreateBundle(PLACES_BUNDLE, getter_AddRefs(bundle));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLString rootTitle;
|
||||
nsAutoString rootTitle;
|
||||
// The first root's title is an empty string.
|
||||
rv = CreateRoot(mMainConn, NS_LITERAL_CSTRING("places"),
|
||||
NS_LITERAL_CSTRING("root________"), rootTitle);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Fetch the internationalized folder name from the string bundle.
|
||||
rv = bundle->GetStringFromName("BookmarksMenuFolderTitle",
|
||||
getter_Copies(rootTitle));
|
||||
rv = bundle->GetStringFromName("BookmarksMenuFolderTitle", rootTitle);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = CreateRoot(mMainConn, NS_LITERAL_CSTRING("menu"),
|
||||
NS_LITERAL_CSTRING("menu________"), rootTitle);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = bundle->GetStringFromName("BookmarksToolbarFolderTitle",
|
||||
getter_Copies(rootTitle));
|
||||
rv = bundle->GetStringFromName("BookmarksToolbarFolderTitle", rootTitle);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = CreateRoot(mMainConn, NS_LITERAL_CSTRING("toolbar"),
|
||||
NS_LITERAL_CSTRING("toolbar_____"), rootTitle);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = bundle->GetStringFromName("TagsFolderTitle",
|
||||
getter_Copies(rootTitle));
|
||||
rv = bundle->GetStringFromName("TagsFolderTitle", rootTitle);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = CreateRoot(mMainConn, NS_LITERAL_CSTRING("tags"),
|
||||
NS_LITERAL_CSTRING("tags________"), rootTitle);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = bundle->GetStringFromName("OtherBookmarksFolderTitle",
|
||||
getter_Copies(rootTitle));
|
||||
rv = bundle->GetStringFromName("OtherBookmarksFolderTitle", rootTitle);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = CreateRoot(mMainConn, NS_LITERAL_CSTRING("unfiled"),
|
||||
NS_LITERAL_CSTRING("unfiled_____"), rootTitle);
|
||||
@ -1401,9 +1397,8 @@ Database::UpdateBookmarkRootTitles()
|
||||
};
|
||||
|
||||
for (uint32_t i = 0; i < ArrayLength(rootGuids); ++i) {
|
||||
nsXPIDLString title;
|
||||
rv = bundle->GetStringFromName(titleStringIDs[i],
|
||||
getter_Copies(title));
|
||||
nsAutoString title;
|
||||
rv = bundle->GetStringFromName(titleStringIDs[i], title);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<mozIStorageBindingParams> params;
|
||||
|
@ -4221,9 +4221,8 @@ nsNavHistory::GetAgeInDaysString(int32_t aInt, const char* aName,
|
||||
nsAutoString intString;
|
||||
intString.AppendInt(aInt);
|
||||
const char16_t* strings[1] = { intString.get() };
|
||||
nsXPIDLString value;
|
||||
nsresult rv = bundle->FormatStringFromName(aName, strings,
|
||||
1, getter_Copies(value));
|
||||
nsAutoString value;
|
||||
nsresult rv = bundle->FormatStringFromName(aName, strings, 1, value);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
CopyUTF16toUTF8(value, aResult);
|
||||
return;
|
||||
@ -4237,8 +4236,8 @@ nsNavHistory::GetStringFromName(const char* aName, nsACString& aResult)
|
||||
{
|
||||
nsIStringBundle *bundle = GetBundle();
|
||||
if (bundle) {
|
||||
nsXPIDLString value;
|
||||
nsresult rv = bundle->GetStringFromName(aName, getter_Copies(value));
|
||||
nsAutoString value;
|
||||
nsresult rv = bundle->GetStringFromName(aName, value);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
CopyUTF16toUTF8(value, aResult);
|
||||
return;
|
||||
|
@ -108,9 +108,9 @@ GetLocalizedString(nsIStringBundle* aStrBundle, const char* aKey, nsString& oVal
|
||||
NS_ENSURE_ARG_POINTER(aKey);
|
||||
|
||||
// Determine default label from string bundle
|
||||
nsXPIDLString valUni;
|
||||
nsresult rv = aStrBundle->GetStringFromName(aKey, getter_Copies(valUni));
|
||||
if (NS_SUCCEEDED(rv) && valUni) {
|
||||
nsAutoString valUni;
|
||||
nsresult rv = aStrBundle->GetStringFromName(aKey, valUni);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
oVal.Assign(valUni);
|
||||
} else {
|
||||
oVal.Truncate();
|
||||
|
@ -198,6 +198,7 @@ class CSPValidator final : public nsCSPSrcVisitor {
|
||||
{
|
||||
// Start with the default error message for a missing directive, since no
|
||||
// visitors will be called if the directive isn't present.
|
||||
mError.SetIsVoid(true);
|
||||
if (aDirectiveRequired) {
|
||||
FormatError("csp.error.missing-directive");
|
||||
}
|
||||
@ -368,8 +369,8 @@ class CSPValidator final : public nsCSPSrcVisitor {
|
||||
nsCOMPtr<nsIStringBundle> stringBundle = GetStringBundle();
|
||||
|
||||
if (stringBundle) {
|
||||
rv = stringBundle->FormatStringFromName(aName, aParams, aLength,
|
||||
getter_Copies(mError));
|
||||
rv =
|
||||
stringBundle->FormatStringFromName(aName, aParams, aLength, mError);
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
@ -382,7 +383,7 @@ class CSPValidator final : public nsCSPSrcVisitor {
|
||||
|
||||
nsAutoString mURL;
|
||||
NS_ConvertASCIItoUTF16 mDirective;
|
||||
nsXPIDLString mError;
|
||||
nsString mError;
|
||||
|
||||
bool mFoundSelf;
|
||||
};
|
||||
|
@ -107,7 +107,7 @@ XPCOMUtils.defineLazyPreferenceGetter(this, "legacyWarningExceptions",
|
||||
raw => raw.split(","));
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "legacyExtensionsEnabled",
|
||||
PREF_LEGACY_ENABLED, true,
|
||||
() => gLegacyView.refresh());
|
||||
() => gLegacyView.refreshVisibility());
|
||||
|
||||
document.addEventListener("load", initialize, true);
|
||||
window.addEventListener("unload", shutdown);
|
||||
@ -483,7 +483,7 @@ if (window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
|
||||
var gEventManager = {
|
||||
_listeners: {},
|
||||
_installListeners: [],
|
||||
_installListeners: new Set(),
|
||||
|
||||
initialize() {
|
||||
const ADDON_EVENTS = ["onEnabling", "onEnabled", "onDisabling",
|
||||
@ -569,32 +569,22 @@ var gEventManager = {
|
||||
|
||||
registerAddonListener(aListener, aAddonId) {
|
||||
if (!(aAddonId in this._listeners))
|
||||
this._listeners[aAddonId] = [];
|
||||
else if (this._listeners[aAddonId].indexOf(aListener) != -1)
|
||||
return;
|
||||
this._listeners[aAddonId].push(aListener);
|
||||
this._listeners[aAddonId] = new Set();
|
||||
this._listeners[aAddonId].add(aListener);
|
||||
},
|
||||
|
||||
unregisterAddonListener(aListener, aAddonId) {
|
||||
if (!(aAddonId in this._listeners))
|
||||
return;
|
||||
var index = this._listeners[aAddonId].indexOf(aListener);
|
||||
if (index == -1)
|
||||
return;
|
||||
this._listeners[aAddonId].splice(index, 1);
|
||||
this._listeners[aAddonId].delete(aListener);
|
||||
},
|
||||
|
||||
registerInstallListener(aListener) {
|
||||
if (this._installListeners.indexOf(aListener) != -1)
|
||||
return;
|
||||
this._installListeners.push(aListener);
|
||||
this._installListeners.add(aListener);
|
||||
},
|
||||
|
||||
unregisterInstallListener(aListener) {
|
||||
var i = this._installListeners.indexOf(aListener);
|
||||
if (i == -1)
|
||||
return;
|
||||
this._installListeners.splice(i, 1);
|
||||
this._installListeners.delete(aListener);
|
||||
},
|
||||
|
||||
delegateAddonEvent(aEvent, aParams) {
|
||||
@ -602,10 +592,9 @@ var gEventManager = {
|
||||
if (!(addon.id in this._listeners))
|
||||
return;
|
||||
|
||||
var listeners = this._listeners[addon.id];
|
||||
for (let listener of listeners) {
|
||||
function tryListener(listener) {
|
||||
if (!(aEvent in listener))
|
||||
continue;
|
||||
return;
|
||||
try {
|
||||
listener[aEvent].apply(listener, aParams);
|
||||
} catch (e) {
|
||||
@ -613,6 +602,14 @@ var gEventManager = {
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
for (let listener of this._listeners[addon.id]) {
|
||||
tryListener(listener);
|
||||
}
|
||||
// eslint-disable-next-line dot-notation
|
||||
for (let listener of this._listeners["ANY"]) {
|
||||
tryListener(listener);
|
||||
}
|
||||
},
|
||||
|
||||
delegateInstallEvent(aEvent, aParams) {
|
||||
@ -2788,7 +2785,17 @@ var gLegacyView = {
|
||||
|
||||
document.getElementById("legacy-learnmore").href = SUPPORT_URL + "webextensions";
|
||||
|
||||
this.refresh();
|
||||
gEventManager.registerAddonListener(this, "ANY");
|
||||
|
||||
this.refreshVisibility();
|
||||
},
|
||||
|
||||
shutdown() {
|
||||
gEventManager.unregisterAddonListener(this, "ANY");
|
||||
},
|
||||
|
||||
onUninstalled() {
|
||||
this.refreshVisibility();
|
||||
},
|
||||
|
||||
async show(type, request) {
|
||||
@ -2824,7 +2831,7 @@ var gLegacyView = {
|
||||
return null;
|
||||
},
|
||||
|
||||
async refresh() {
|
||||
async refreshVisibility() {
|
||||
if (legacyExtensionsEnabled) {
|
||||
this._categoryItem.disabled = true;
|
||||
return;
|
||||
@ -2852,6 +2859,16 @@ var gLegacyView = {
|
||||
this._categoryItem.disabled = true;
|
||||
}
|
||||
},
|
||||
|
||||
getListItemForID(aId) {
|
||||
var listitem = this._listBox.firstChild;
|
||||
while (listitem) {
|
||||
if (listitem.getAttribute("status") == "installed" && listitem.mAddon.id == aId)
|
||||
return listitem;
|
||||
listitem = listitem.nextSibling;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
var gListView = {
|
||||
|
@ -111,7 +111,7 @@ add_task(async function() {
|
||||
// The legacy category does not watch for new installs since new
|
||||
// legacy extensions cannot be installed while legacy extensions
|
||||
// are disabled, so manually refresh it here.
|
||||
await mgrWin.gLegacyView.refresh();
|
||||
await mgrWin.gLegacyView.refreshVisibility();
|
||||
|
||||
// Make sure we re-render the extensions list, after that we should
|
||||
// still just have the original two entries.
|
||||
@ -156,7 +156,7 @@ add_task(async function() {
|
||||
});
|
||||
|
||||
// The entry on the left side should now read "Unsupported"
|
||||
await mgrWin.gLegacyView.refresh();
|
||||
await mgrWin.gLegacyView.refreshVisibility();
|
||||
is(catItem.disabled, false, "Legacy category is visible");
|
||||
is(catItem.getAttribute("name"), get_string("type.unsupported.name"),
|
||||
"Category label with unsigned extensions is correct");
|
||||
@ -186,7 +186,7 @@ add_task(async function() {
|
||||
});
|
||||
|
||||
// The name of the pane should go back to "Legacy Extensions"
|
||||
await mgrWin.gLegacyView.refresh();
|
||||
await mgrWin.gLegacyView.refreshVisibility();
|
||||
is(catItem.disabled, false, "Legacy category is visible");
|
||||
is(catItem.getAttribute("name"), get_string("type.legacy.name"),
|
||||
"Category label with no unsigned extensions is correct");
|
||||
|
@ -256,8 +256,7 @@ nsAlertsIconListener::InitAlertAsync(nsIAlertNotification* aAlert,
|
||||
nsAutoString appName;
|
||||
|
||||
if (bundle) {
|
||||
bundle->GetStringFromName("brandShortName",
|
||||
getter_Copies(appName));
|
||||
bundle->GetStringFromName("brandShortName", appName);
|
||||
appShortName = NS_ConvertUTF16toUTF8(appName);
|
||||
} else {
|
||||
NS_WARNING("brand.properties not present, using default application name");
|
||||
|
@ -87,11 +87,11 @@ ProfileResetCleanup(nsIToolkitProfile* aOldProfile)
|
||||
NS_ConvertUTF8toUTF16 appName(gAppData->name);
|
||||
const char16_t* params[] = {appName.get(), appName.get()};
|
||||
|
||||
nsXPIDLString resetBackupDirectoryName;
|
||||
nsAutoString resetBackupDirectoryName;
|
||||
|
||||
static const char* kResetBackupDirectory = "resetBackupDirectory";
|
||||
rv = sb->FormatStringFromName(kResetBackupDirectory, params, 2,
|
||||
getter_Copies(resetBackupDirectoryName));
|
||||
resetBackupDirectoryName);
|
||||
|
||||
// Get info to copy the old root profile dir to the desktop as a backup.
|
||||
nsCOMPtr<nsIFile> backupDest, containerDest, profileDest;
|
||||
|
@ -1957,23 +1957,21 @@ ProfileLockedDialog(nsIFile* aProfileDir, nsIFile* aProfileLocalDir,
|
||||
NS_ConvertUTF8toUTF16 appName(gAppData->name);
|
||||
const char16_t* params[] = {appName.get(), appName.get()};
|
||||
|
||||
nsXPIDLString killMessage;
|
||||
nsAutoString killMessage;
|
||||
#ifndef XP_MACOSX
|
||||
sb->FormatStringFromName(aUnlocker ? "restartMessageUnlocker"
|
||||
: "restartMessageNoUnlocker",
|
||||
params, 2, getter_Copies(killMessage));
|
||||
rv = sb->FormatStringFromName(aUnlocker ? "restartMessageUnlocker"
|
||||
: "restartMessageNoUnlocker",
|
||||
params, 2, killMessage);
|
||||
#else
|
||||
sb->FormatStringFromName(aUnlocker ? "restartMessageUnlockerMac"
|
||||
: "restartMessageNoUnlockerMac",
|
||||
params, 2, getter_Copies(killMessage));
|
||||
rv = sb->FormatStringFromName(aUnlocker ? "restartMessageUnlockerMac"
|
||||
: "restartMessageNoUnlockerMac",
|
||||
params, 2, killMessage);
|
||||
#endif
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
|
||||
nsXPIDLString killTitle;
|
||||
sb->FormatStringFromName("restartTitle",
|
||||
params, 1, getter_Copies(killTitle));
|
||||
|
||||
if (!killMessage || !killTitle)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsAutoString killTitle;
|
||||
rv = sb->FormatStringFromName("restartTitle", params, 1, killTitle);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
|
||||
if (gfxPlatform::IsHeadless()) {
|
||||
// TODO: make a way to turn off all dialogs when headless.
|
||||
@ -1998,8 +1996,8 @@ ProfileLockedDialog(nsIFile* aProfileDir, nsIFile* aProfileLocalDir,
|
||||
nsIPromptService::BUTTON_POS_1);
|
||||
|
||||
bool checkState = false;
|
||||
rv = ps->ConfirmEx(nullptr, killTitle, killMessage, flags,
|
||||
killTitle, nullptr, nullptr, nullptr,
|
||||
rv = ps->ConfirmEx(nullptr, killTitle.get(), killMessage.get(), flags,
|
||||
killTitle.get(), nullptr, nullptr, nullptr,
|
||||
&checkState, &button);
|
||||
NS_ENSURE_SUCCESS_LOG(rv, rv);
|
||||
#endif
|
||||
@ -2022,7 +2020,7 @@ ProfileLockedDialog(nsIFile* aProfileDir, nsIFile* aProfileLocalDir,
|
||||
nullptr, aResult);
|
||||
}
|
||||
#else
|
||||
rv = ps->Alert(nullptr, killTitle, killMessage);
|
||||
rv = ps->Alert(nullptr, killTitle.get(), killMessage.get());
|
||||
NS_ENSURE_SUCCESS_LOG(rv, rv);
|
||||
#endif
|
||||
}
|
||||
@ -2055,23 +2053,19 @@ ProfileMissingDialog(nsINativeAppSupport* aNative)
|
||||
NS_ConvertUTF8toUTF16 appName(gAppData->name);
|
||||
const char16_t* params[] = {appName.get(), appName.get()};
|
||||
|
||||
nsXPIDLString missingMessage;
|
||||
|
||||
// profileMissing
|
||||
sb->FormatStringFromName("profileMissing",
|
||||
params, 2, getter_Copies(missingMessage));
|
||||
nsAutoString missingMessage;
|
||||
rv = sb->FormatStringFromName("profileMissing", params, 2, missingMessage);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_ABORT);
|
||||
|
||||
nsXPIDLString missingTitle;
|
||||
sb->FormatStringFromName("profileMissingTitle",
|
||||
params, 1, getter_Copies(missingTitle));
|
||||
nsAutoString missingTitle;
|
||||
rv = sb->FormatStringFromName("profileMissingTitle", params, 1, missingTitle);
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_ABORT);
|
||||
|
||||
if (missingMessage && missingTitle) {
|
||||
nsCOMPtr<nsIPromptService> ps
|
||||
(do_GetService(NS_PROMPTSERVICE_CONTRACTID));
|
||||
NS_ENSURE_TRUE(ps, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIPromptService> ps(do_GetService(NS_PROMPTSERVICE_CONTRACTID));
|
||||
NS_ENSURE_TRUE(ps, NS_ERROR_FAILURE);
|
||||
|
||||
ps->Alert(nullptr, missingTitle, missingMessage);
|
||||
}
|
||||
ps->Alert(nullptr, missingTitle.get(), missingMessage.get());
|
||||
|
||||
return NS_ERROR_ABORT;
|
||||
}
|
||||
|
@ -1162,9 +1162,8 @@ NS_IMETHODIMP nsDocLoader::OnStatus(nsIRequest* aRequest, nsISupports* ctxt,
|
||||
mozilla::services::GetStringBundleService();
|
||||
if (!sbs)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsXPIDLString msg;
|
||||
nsresult rv = sbs->FormatStatusMessage(aStatus, aStatusArg,
|
||||
getter_Copies(msg));
|
||||
nsAutoString msg;
|
||||
nsresult rv = sbs->FormatStatusMessage(aStatus, aStatusArg, msg);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
@ -1185,7 +1184,7 @@ NS_IMETHODIMP nsDocLoader::OnStatus(nsIRequest* aRequest, nsISupports* ctxt,
|
||||
// Put the info at the front of the list
|
||||
mStatusInfoList.insertFront(info->mLastStatus);
|
||||
}
|
||||
FireOnStatusChange(this, aRequest, aStatus, msg);
|
||||
FireOnStatusChange(this, aRequest, aStatus, msg.get());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1864,24 +1864,24 @@ void nsExternalAppHandler::SendStatusChange(ErrorType type, nsresult rv, nsIRequ
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
if (NS_SUCCEEDED(stringService->CreateBundle("chrome://global/locale/nsWebBrowserPersist.properties",
|
||||
getter_AddRefs(bundle)))) {
|
||||
nsXPIDLString msgText;
|
||||
nsAutoString msgText;
|
||||
const char16_t *strings[] = { path.get() };
|
||||
if (NS_SUCCEEDED(bundle->FormatStringFromName(msgId, strings, 1,
|
||||
getter_Copies(msgText)))) {
|
||||
msgText))) {
|
||||
if (mDialogProgressListener) {
|
||||
// We have a listener, let it handle the error.
|
||||
mDialogProgressListener->OnStatusChange(nullptr, (type == kReadError) ? aRequest : nullptr, rv, msgText);
|
||||
mDialogProgressListener->OnStatusChange(nullptr, (type == kReadError) ? aRequest : nullptr, rv, msgText.get());
|
||||
} else if (mTransfer) {
|
||||
mTransfer->OnStatusChange(nullptr, (type == kReadError) ? aRequest : nullptr, rv, msgText);
|
||||
mTransfer->OnStatusChange(nullptr, (type == kReadError) ? aRequest : nullptr, rv, msgText.get());
|
||||
} else if (XRE_IsParentProcess()) {
|
||||
// We don't have a listener. Simply show the alert ourselves.
|
||||
nsresult qiRv;
|
||||
nsCOMPtr<nsIPrompt> prompter(do_GetInterface(GetDialogParent(), &qiRv));
|
||||
nsXPIDLString title;
|
||||
nsAutoString title;
|
||||
bundle->FormatStringFromName("title",
|
||||
strings,
|
||||
1,
|
||||
getter_Copies(title));
|
||||
title);
|
||||
|
||||
MOZ_LOG(nsExternalHelperAppService::mLog, LogLevel::Debug,
|
||||
("mContentContext=0x%p, prompter=0x%p, qi rv=0x%08"
|
||||
@ -1921,7 +1921,7 @@ void nsExternalAppHandler::SendStatusChange(ErrorType type, nsresult rv, nsIRequ
|
||||
}
|
||||
|
||||
// We should always have a prompter at this point.
|
||||
prompter->Alert(title, msgText);
|
||||
prompter->Alert(title.get(), msgText.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -298,11 +298,11 @@ OSXNotificationCenter::ShowAlertWithIconData(nsIAlertNotification* aAlert,
|
||||
|
||||
if (!hostPort.IsEmpty() && bundle) {
|
||||
const char16_t* formatStrings[] = { hostPort.get() };
|
||||
nsXPIDLString notificationSource;
|
||||
nsAutoString notificationSource;
|
||||
bundle->FormatStringFromName("source.label",
|
||||
formatStrings,
|
||||
ArrayLength(formatStrings),
|
||||
getter_Copies(notificationSource));
|
||||
notificationSource);
|
||||
notification.subtitle = nsCocoaUtils::ToNSString(notificationSource);
|
||||
}
|
||||
|
||||
@ -317,20 +317,17 @@ OSXNotificationCenter::ShowAlertWithIconData(nsIAlertNotification* aAlert,
|
||||
// If this is not an application/extension alert, show additional actions dealing with permissions.
|
||||
bool isActionable;
|
||||
if (bundle && NS_SUCCEEDED(aAlert->GetActionable(&isActionable)) && isActionable) {
|
||||
nsXPIDLString closeButtonTitle, actionButtonTitle, disableButtonTitle, settingsButtonTitle;
|
||||
bundle->GetStringFromName("closeButton.title",
|
||||
getter_Copies(closeButtonTitle));
|
||||
bundle->GetStringFromName("actionButton.label",
|
||||
getter_Copies(actionButtonTitle));
|
||||
nsAutoString closeButtonTitle, actionButtonTitle, disableButtonTitle, settingsButtonTitle;
|
||||
bundle->GetStringFromName("closeButton.title", closeButtonTitle);
|
||||
bundle->GetStringFromName("actionButton.label", actionButtonTitle);
|
||||
if (!hostPort.IsEmpty()) {
|
||||
const char16_t* formatStrings[] = { hostPort.get() };
|
||||
bundle->FormatStringFromName("webActions.disableForOrigin.label",
|
||||
formatStrings,
|
||||
ArrayLength(formatStrings),
|
||||
getter_Copies(disableButtonTitle));
|
||||
disableButtonTitle);
|
||||
}
|
||||
bundle->GetStringFromName("webActions.settings.label",
|
||||
getter_Copies(settingsButtonTitle));
|
||||
bundle->GetStringFromName("webActions.settings.label", settingsButtonTitle);
|
||||
|
||||
notification.otherButtonTitle = nsCocoaUtils::ToNSString(closeButtonTitle);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user