Bug 228501 Fix mailWidgets to tokenize search headers in the same way as the C++, also fixing a JavsScript strict warning r=bienvenu sr=mscott

This commit is contained in:
neil%parkwaycc.co.uk 2003-12-19 21:49:08 +00:00
Родитель f47f31c191
Коммит 355f8689f0
1 изменённых файлов: 5 добавлений и 13 удалений

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

@ -979,29 +979,21 @@
var strings = new Array; var strings = new Array;
var ids = this.valueIds; var ids = this.valueIds;
var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var hdrs; var hdrsArray = null;
try try
{ {
hdrs = pref.getCharPref("mailnews.customHeaders"); var hdrs = pref.getCharPref("mailnews.customHeaders");
hdrs = hdrs.replace(/\s+/g,''); //remove white spaces before splitting
hdrsArray = hdrs.match(/[^:]+/g);
} }
catch(ex) catch(ex)
{ {
hdrs=null;
}
var hdrsArray = new Array;
if (hdrs)
{
hdrs = hdrs.replace(/\s+/g,''); //remove white spaces before splitting
hdrsArray = hdrs.split(":");
for (var i = 0; i< hdrsArray.length; i++)
if (!hdrsArray[i])
hdrsArray.splice(i,1); //remove any null elements
} }
var bundle = this.stringBundle; var bundle = this.stringBundle;
var j=0; var j=0;
for (var i=0; i<ids.length; i++) for (var i=0; i<ids.length; i++)
{ {
if(ids[i] > Components.interfaces.nsMsgSearchAttrib.OtherHeader && hdrs) if(ids[i] > Components.interfaces.nsMsgSearchAttrib.OtherHeader && hdrsArray)
strings[i] = hdrsArray[j++]; strings[i] = hdrsArray[j++];
else else
strings[i] = this.stringBundle.GetStringFromID(ids[i]); strings[i] = this.stringBundle.GetStringFromID(ids[i]);