Bug 1556925 - C-C part: Adapt to array changes in mozISpellCheckingEngine.getDictionaryList, take 2. r=jorgk
authorGeoff Lankow <geoff@darktrojan.net>
Thu, 06 Jun 2019 18:22:44 +1200
changeset 35788 832d8eca475e442d2c51aa23f81d26a6cffffc0b
parent 35787 53cdd29d9280a6c00b5a96ccc470c15e5de8992f
child 35789 41e1b638798e45bbdee04481be179cbedf0284f8
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersjorgk
bugs1556925
Bug 1556925 - C-C part: Adapt to array changes in mozISpellCheckingEngine.getDictionaryList, take 2. r=jorgk
mail/components/compose/content/MsgComposeCommands.js
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -2375,21 +2375,19 @@ function getValidSpellcheckerDictionary(
 var dictionaryRemovalObserver = {
   observe(aSubject, aTopic, aData) {
     if (aTopic != "spellcheck-dictionary-remove") {
       return;
     }
     let language = document.documentElement.getAttribute("lang");
     let spellChecker = Cc["@mozilla.org/spellchecker/engine;1"]
                          .getService(Ci.mozISpellCheckingEngine);
-    let o1 = {};
-    let o2 = {};
-    spellChecker.getDictionaryList(o1, o2);
-    let dictList = o1.value;
-    let count    = o2.value;
+
+    let dictList = spellChecker.getDictionaryList();
+    let count    = dictList.length;
 
     if (count > 0 && dictList.includes(language)) {
       // There still is a dictionary for the language of the document.
       return;
     }
 
     // Set a valid language from the preference.
     let prefValue = Services.prefs.getCharPref("spellchecker.dictionary");
@@ -3838,26 +3836,22 @@ function showPopupById(aPopupID, aAnchor
 
 function InitLanguageMenu() {
   var languageMenuList = document.getElementById("languageMenuList");
   if (!languageMenuList)
     return;
 
   var spellChecker = Cc["@mozilla.org/spellchecker/engine;1"]
                        .getService(Ci.mozISpellCheckingEngine);
-  var o1 = {};
-  var o2 = {};
 
   // Get the list of dictionaries from
   // the spellchecker.
 
-  spellChecker.getDictionaryList(o1, o2);
-
-  var dictList = o1.value;
-  var count    = o2.value;
+  var dictList = spellChecker.getDictionaryList();
+  var count    = dictList.length;
 
   // If dictionary count hasn't changed then no need to update the menu.
   if (sDictCount == count)
     return;
 
   // Store current dictionary count.
   sDictCount = count;