Bug 1386600 - Change nsIStringBundle methods to return |AString| instead of |wstring|. r=emk,sr=dbaron.

This removes about 2/3 of the occurrences of nsXPIDLString in the tree. The
places where nsXPIDLStrings are null-checked are replaced with |rv| checks.

The patch also removes a couple of unused declarations from
nsIStringBundle.idl.

Note that nsStringBundle::GetStringFromNameHelper() was merged into
GetStringFromName(), because they both would have had the same signature.
This commit is contained in:
Nicholas Nethercote
2017-08-04 14:40:52 +10:00
parent 3fea542b3f
commit 723f585d9c
101 changed files with 464 additions and 566 deletions

View File

@@ -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);