Bug 824150 - Code cleanup in /mail/ and /mailnews/: Use new String methods like startsWith, endsWith, contains, remaining Services.jsm switches and querySelector use instead of NodeList calls: import. r=mbanner

This commit is contained in:
Sebastian Hengst 2013-02-07 17:20:34 +01:00
Родитель bd545e69cd
Коммит 9a932adbed
2 изменённых файлов: 6 добавлений и 10 удалений

Просмотреть файл

@ -66,7 +66,7 @@ function SetUpImportType()
document.getElementById("importFields").value = importType;
// Mac migration not working right now, so disable it
if (navigator.platform.match("^Mac"))
if (navigator.platform.startsWith("Mac"))
{
document.getElementById("allRadio").setAttribute("disabled", "true");
if (importType == "all")
@ -419,7 +419,7 @@ function ListFeedAccounts() {
}
function ContinueImport( info) {
var isMail = info.importType == 'mail' ? true : false;
var isMail = info.importType == 'mail';
var clear = true;
var deck;
var pcnt;
@ -552,7 +552,7 @@ function ShowImportResultsRaw(title, results, good)
// If the Local Folder is not existed, create it after successfully
// import "mail" and "settings"
var checkLocalFolder = (top.progressInfo.importType == 'mail' || top.progressInfo.importType == 'settings') ? true : false;
var checkLocalFolder = (top.progressInfo.importType == 'mail' || top.progressInfo.importType == 'settings');
if (good && checkLocalFolder && !top.progressInfo.localFolderExists) {
var am = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
if (am)

Просмотреть файл

@ -107,10 +107,6 @@ GenericImportHelper.prototype =
}
};
function endsWith(string, suffix) {
return string.indexOf(suffix, string.length - suffix.length) != -1;
}
/**
* AbImportHelper
* A helper for Address Book imports. To use, supply at least the file and type.
@ -153,13 +149,13 @@ function AbImportHelper(aFile, aModuleSearchString, aAbName, aJsonName)
"Custom1", "Custom2", "Custom3", "Custom4", "Notes", "_AimScreenName"];
// get the extra attributes supported for the given type of import
if (endsWith(this.mFile.leafName.toLowerCase(), ".ldif")) {
if (this.mFile.leafName.toLowerCase().endsWith(".ldif")) {
// LDIF: add PreferMailFormat
this.mSupportedAttributes = supportedAttributes.concat(["PreferMailFormat"]);
} else if (endsWith(this.mFile.leafName.toLowerCase(), ".csv")) {
} else if (this.mFile.leafName.toLowerCase().endsWith(".csv")) {
this.mSupportedAttributes = supportedAttributes;
this.setFieldMap(this.getDefaultFieldMap(true));
} else if (endsWith(this.mFile.leafName.toLowerCase(), ".vcf")) {
} else if (this.mFile.leafName.toLowerCase().endsWith(".vcf")) {
this.mSupportedAttributes = supportedAttributes;
};