fix for bug 205895 - make nsIMIMEInfo.getFileExtensions use a string enumerator, to avoid excess allocation at startup

r=bz, sr=darin
This commit is contained in:
alecf%flett.org 2006-07-29 05:42:12 +00:00
Родитель 7c46f5edf0
Коммит 94e749354a
1 изменённых файлов: 10 добавлений и 9 удалений

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

@ -619,18 +619,19 @@ function appendFiltersForContentType(aFilePicker, aContentType, aSaveMode)
var mimeInfo = getMIMEInfoForType(aContentType);
if (mimeInfo) {
var extCount = { };
var extList = { };
mimeInfo.GetFileExtensions(extCount, extList);
var extEnumerator = mimeInfo.getFileExtensions();
var extString = "";
for (var i = 0; i < extCount.value; ++i) {
if (i > 0)
extString += "; "; // If adding more than one extension, separate by semi-colon
extString += "*." + extList.value[i];
while (extEnumerator.hasMore()) {
var extension = extEnumerator.getNext();
if (extString)
extString += "; "; // If adding more than one extension,
// separate by semi-colon
extString += "*." + extension;
}
if (extCount.value > 0) {
if (extString) {
aFilePicker.appendFilter(mimeInfo.Description, extString);
}
}