Bug 880595 Unable to compose a reply using a recycled window r+a=Standard8
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Thu, 25 Jul 2013 23:28:23 +0100
changeset 15860 d4eb28c60ab571d163678a0c95c26bb2ad620f05
parent 15859 4748f12ac8a16e4245fc48a3279aae68a45ca31b
child 15861 652ace3eb273c1b76232013b284030cc1553a83e
push id942
push userbugzilla@standard8.plus.com
push dateMon, 05 Aug 2013 19:15:38 +0000
treeherdercomm-beta@0e1a1c4a9f0c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs880595
Bug 880595 Unable to compose a reply using a recycled window r+a=Standard8 a=Standard8 for checkin to a CLOSED TREE
mail/components/compose/content/MsgComposeCommands.js
suite/mailnews/compose/MsgComposeCommands.js
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -3166,17 +3166,32 @@ function addRecipientsToIgnoreList(aAddr
         // now tokenize off of white space
         let splitNamesFromWhiteSpaceArray = splitNames[i].split(' ');
         for (let whiteSpaceIndex = 0; whiteSpaceIndex < splitNamesFromWhiteSpaceArray.length; whiteSpaceIndex++)
           if (splitNamesFromWhiteSpaceArray[whiteSpaceIndex])
             tokenizedNames.push(splitNamesFromWhiteSpaceArray[whiteSpaceIndex]);
       }
     }
 
-    gSpellChecker.mInlineSpellChecker.ignoreWords(tokenizedNames, tokenizedNames.length);
+
+    if (gSpellChecker.mInlineSpellChecker.spellCheckPending)
+    {
+      // spellchecker is enabled, but we must wait for its init to complete
+      Services.obs.addObserver(function observe(subject, topic, data) {
+        if (subject == gMsgCompose.editor)
+        {
+          Services.obs.removeObserver(observe, topic);
+          gSpellChecker.mInlineSpellChecker.ignoreWords(tokenizedNames, tokenizedNames.length);
+        }
+      }, "inlineSpellChecker-spellCheck-ended", false);
+    }
+    else
+    {
+      gSpellChecker.mInlineSpellChecker.ignoreWords(tokenizedNames, tokenizedNames.length);
+    }
   }
 }
 
 function onAddressColCommand(aAddressWidgetId)
 {
   gContentChanged = true;
   awSetAutoComplete(aAddressWidgetId.slice(aAddressWidgetId.lastIndexOf('#') + 1));
   updateSendCommands(true);
--- a/suite/mailnews/compose/MsgComposeCommands.js
+++ b/suite/mailnews/compose/MsgComposeCommands.js
@@ -2074,17 +2074,31 @@ function addRecipientsToIgnoreList(aAddr
     {
       if (!names.value[i])
         continue;
       var splitNames = names.value[i].match(/[^\s,]+/g);
       if (splitNames)
         tokenizedNames = tokenizedNames.concat(splitNames);
     }
 
-    InlineSpellCheckerUI.mInlineSpellChecker.ignoreWords(tokenizedNames, tokenizedNames.length);
+    if (InlineSpellCheckerUI.mInlineSpellChecker.spellCheckPending)
+    {
+      // spellchecker is enabled, but we must wait for its init to complete
+      Services.obs.addObserver(function observe(subject, topic, data) {
+        if (subject == gMsgCompose.editor)
+        {
+          Services.obs.removeObserver(observe, topic);
+          InlineSpellCheckerUI.mInlineSpellChecker.ignoreWords(tokenizedNames, tokenizedNames.length);
+        }
+      }, "inlineSpellChecker-spellCheck-ended", false);
+    }
+    else
+    {
+      InlineSpellCheckerUI.mInlineSpellChecker.ignoreWords(tokenizedNames, tokenizedNames.length);
+    }
   }
 }
 
 function InitLanguageMenu()
 {
   var languageMenuList = document.getElementById("languageMenuList");
   if (!languageMenuList)
     return;