зеркало из https://github.com/mozilla/pjs.git
don't get the prefs on every call. do it once, for performance.
This commit is contained in:
Родитель
1d67d9ba04
Коммит
64de66f3dd
|
@ -58,6 +58,10 @@
|
||||||
|
|
||||||
<html:script language="JavaScript">
|
<html:script language="JavaScript">
|
||||||
|
|
||||||
|
var pref;
|
||||||
|
var prefInitialized = false;
|
||||||
|
var lastFirst = false;
|
||||||
|
|
||||||
function GenerateDisplayName()
|
function GenerateDisplayName()
|
||||||
{
|
{
|
||||||
/* see AB_GenerateDisplayName in http://lxr.mcom.com/nova/source/ns/lib/libaddr/abglue.cpp for the proper logic */
|
/* see AB_GenerateDisplayName in http://lxr.mcom.com/nova/source/ns/lib/libaddr/abglue.cpp for the proper logic */
|
||||||
|
@ -70,18 +74,19 @@ function GenerateDisplayName()
|
||||||
/* this used to be XP_GetString(MK_ADDR_FIRST_LAST_SEP) */
|
/* this used to be XP_GetString(MK_ADDR_FIRST_LAST_SEP) */
|
||||||
var firstLastSep = " ";
|
var firstLastSep = " ";
|
||||||
|
|
||||||
/* todo: move pref out to be a global var for performance? */
|
if (!prefInitialized) {
|
||||||
var pref = Components.classes['component://netscape/preferences'];
|
pref = Components.classes['component://netscape/preferences'];
|
||||||
var lastFirst = false;
|
|
||||||
|
|
||||||
if (pref) {
|
if (pref) {
|
||||||
pref = pref.getService();
|
pref = pref.getService();
|
||||||
}
|
}
|
||||||
if (pref) {
|
if (pref) {
|
||||||
pref = pref.QueryInterface(Components.interfaces.nsIPref);
|
pref = pref.QueryInterface(Components.interfaces.nsIPref);
|
||||||
}
|
}
|
||||||
if (pref) {
|
if (pref) {
|
||||||
lastFirst = pref.GetBoolPref("mail.addr_book.lastnamefirst");
|
lastFirst = pref.GetBoolPref("mail.addr_book.lastnamefirst");
|
||||||
|
}
|
||||||
|
prefInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* todo: mscott says there was a pref in 4.5 that would */
|
/* todo: mscott says there was a pref in 4.5 that would */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче