Bug 1556925 - C-C part: Adapt to array changes in mozISpellCheckingEngine.getDictionaryList. r=jorgk
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 04 Jun 2019 21:13:00 +0200
changeset 35786 8aec6a4a364f83f339a27a4735a110874c84c180
parent 35785 e42c6f062a6cc455125a64824379712e55f1a0c3
child 35787 53cdd29d9280a6c00b5a96ccc470c15e5de8992f
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. r=jorgk
calendar/base/modules/calExtract.jsm
mail/components/compose/content/MsgComposeCommands.js
mail/components/preferences/compose.js
suite/components/nsSuiteGlue.js
suite/components/pref/content/pref-spelling.js
suite/mailnews/components/compose/content/MsgComposeCommands.js
--- a/calendar/base/modules/calExtract.jsm
+++ b/calendar/base/modules/calExtract.jsm
@@ -139,20 +139,17 @@ Extractor.prototype = {
                     langs.splice(idx, 1);
                     Services.prefs.setStringPref(pref, this.fallbackLocale + "," + langs.join(","));
                 }
             }
         } else {
             let spellchecker = Cc["@mozilla.org/spellchecker/engine;1"]
                                  .getService(Ci.mozISpellCheckingEngine);
 
-            let arr = {};
-            let cnt = {};
-            spellchecker.getDictionaryList(arr, cnt);
-            let dicts = arr.value;
+            let dicts = spellchecker.getDictionaryList();
 
             if (dicts.length == 0) {
                 cal.LOG("[calExtract] There are no dictionaries installed and " +
                         "enabled. You might want to add some if date and time " +
                         "extraction from emails seems inaccurate.");
             }
 
             let patterns;
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -2343,21 +2343,19 @@ function AttachmentsChanged(aShowPane, a
  * 2) The selected dictionary changes the way it announces itself to the system,
  *    so for example "it_IT" changes to "it-IT" and the previously stored
  *    preference value doesn't apply any more.
  */
 function getValidSpellcheckerDictionary(draftLanguage) {
   let prefValue = Services.prefs.getCharPref("spellchecker.dictionary");
   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) {
     // If there are no dictionaries, we can't check the value, so return it.
     return prefValue;
   }
 
   // Make sure that the draft language contains a valid value.
   if (draftLanguage && dictList.includes(draftLanguage)) {
--- a/mail/components/preferences/compose.js
+++ b/mail/components/preferences/compose.js
@@ -180,26 +180,22 @@ var gComposePane = {
       // Set pref that there's no default startup view directory any more.
       Services.prefs.setBoolPref("mail.addr_book.view.startupURIisDefault", false);
     }
   },
 
   initLanguageMenu() {
     var languageMenuList = document.getElementById("languageMenuList");
     this.mSpellChecker = Cc["@mozilla.org/spellchecker/engine;1"].getService(Ci.mozISpellCheckingEngine);
-    var o1 = {};
-    var o2 = {};
 
     // Get the list of dictionaries from
     // the spellchecker.
 
-    this.mSpellChecker.getDictionaryList(o1, o2);
-
-    var dictList = o1.value;
-    var count    = o2.value;
+    var dictList = this.mSpellChecker.getDictionaryList();
+    var count    = dictList.length;
 
     // if we don't have any dictionaries installed, disable the menu list
     languageMenuList.disabled = !count;
 
     // If dictionary count hasn't changed then no need to update the menu.
     if (this.mDictCount == count)
       return;
 
--- a/suite/components/nsSuiteGlue.js
+++ b/suite/components/nsSuiteGlue.js
@@ -1157,19 +1157,17 @@ SuiteGlue.prototype = {
     // replace underscore with dash if found in language
     if (/_/.test(prefValue)) {
       prefValue = prefValue.replace(/_/g, "-");
       Services.prefs.setCharPref(prefName, prefValue);
     }
 
     var spellChecker = Cc["@mozilla.org/spellchecker/engine;1"]
                          .getService(Ci.mozISpellCheckingEngine);
-    var o1 = {};
-    spellChecker.getDictionaryList(o1, {});
-    var dictList = o1.value;
+    var dictList = spellChecker.getDictionaryList();
     // If the preference contains an invalid dictionary, set it to a valid
     // dictionary, any dictionary will do.
     if (dictList.length && dictList.indexOf(prefValue) < 0)
       Services.prefs.setCharPref(prefName, dictList[0]);
   },
 
   _migrateDownloadPrefs: function()
   {
--- a/suite/components/pref/content/pref-spelling.js
+++ b/suite/components/pref/content/pref-spelling.js
@@ -16,24 +16,19 @@ function Startup() {
     document.getElementById("noSpellCheckLabel").hidden = false;
   }
 }
 
 function InitLanguageMenu() {
   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 (gDictCount == count)
     return;
 
   // Store current dictionary count.
   gDictCount = count;
 
--- a/suite/mailnews/components/compose/content/MsgComposeCommands.js
+++ b/suite/mailnews/components/compose/content/MsgComposeCommands.js
@@ -2051,24 +2051,19 @@ function addRecipientsToIgnoreList(aAddr
 function InitLanguageMenu()
 {
   var languageMenuList = document.getElementById("languageMenuList");
   if (!languageMenuList)
     return;
 
   var spellChecker = Cc["@mozilla.org/spellchecker/engine;1"]
                        .getService(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;