From 10416e08932662a88ae2f170290e47cfb52e9020 Mon Sep 17 00:00:00 2001 From: "sspitzer%netscape.com" Date: Tue, 30 Jan 2001 21:51:43 +0000 Subject: [PATCH] fix for #67003. make mailCharsetLoadListener() more efficient. r=nhotta, sr=bienvenu --- .../resources/content/charsetOverlay.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/xpfe/global/resources/content/charsetOverlay.js b/xpfe/global/resources/content/charsetOverlay.js index dedacd6eaa5f..e588616f363d 100644 --- a/xpfe/global/resources/content/charsetOverlay.js +++ b/xpfe/global/resources/content/charsetOverlay.js @@ -136,7 +136,7 @@ function UpdateCurrentCharset() function UpdateCurrentMailCharset() { var charset = msgWindow.mailCharacterSet; - dump("UPdate current mail charset: " + charset + " \n"); + dump("Update current mail charset: " + charset + " \n"); var menuitem = document.getElementById('charset.' + charset); @@ -199,21 +199,18 @@ function charsetLoadListener (event) // weird assertion! } +var gCharsetMenu = Components.classes['@mozilla.org/rdf/datasource;1?name=charset-menu'].getService().QueryInterface(Components.interfaces.nsICurrentCharsetListener); +var gLastCurrentCharset = null; + function mailCharsetLoadListener (event) { - var menu = Components.classes['@mozilla.org/rdf/datasource;1?name=charset-menu']; - - if (menu) { - menu = menu.getService(); - menu = menu.QueryInterface(Components.interfaces.nsICurrentCharsetListener); - - if (msgWindow) { + if (msgWindow) { var charset = msgWindow.mailCharacterSet; - if (charset.length > 0) { - menu.SetCurrentMailCharset(charset); + if (charset.length > 0 && (charset != gLastCurrentCharset)) { + gCharsetMenu.SetCurrentMailCharset(charset); + gLastCurrentCharset = charset; dump("mailCharsetLoadListener: " + charset + " \n"); } - } } }