Bug 1208971 - Do not abort processing during startup if the dictionary preference is not set. r=Neil, a=IanN CLOSED TREE a=IanN(Aurora)
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Thu, 14 Jan 2016 22:05:56 +0100
changeset 26647 1908f1a3f8e5c892649412d8ac9888b2c9c6fd30
parent 26646 3eb75c3af991e7e1f08360ca314b2f1d8c0151b9
child 26648 5447402bbd41af11a7be3656ccb4df9dfa969260
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil, IanN, IanN
bugs1208971
Bug 1208971 - Do not abort processing during startup if the dictionary preference is not set. r=Neil, a=IanN CLOSED TREE a=IanN(Aurora)
suite/common/src/nsSuiteGlue.js
--- a/suite/common/src/nsSuiteGlue.js
+++ b/suite/common/src/nsSuiteGlue.js
@@ -953,23 +953,30 @@ SuiteGlue.prototype = {
     // tri-state; 0=always but not accessibility themes, 1=always, 2=never
     try {
       if (!Services.prefs.getBoolPref("browser.display.use_document_colors")) {
         Services.prefs.setIntPref("browser.display.document_color_use", 2);
         Services.prefs.clearUserPref("browser.display.use_document_colors");
       }
     } catch (ex) {}
 
-    // Ensure that this preference is set to a valid dictionary.
+    // try to get dictionary preference and initialize with blank if not set
     var prefName = "spellchecker.dictionary";
-    var prefValue = Services.prefs.getCharPref(prefName);
+    var prefValue = "";
+
+    try {
+      prefValue = Services.prefs.getCharPref(prefName);
+    } catch (ex) {}
+
+    // replace underscore with dash if found in language
     if (/_/.test(prefValue)) {
       prefValue = prefValue.replace(/_/g, "-");
       Services.prefs.setCharPref(prefName, prefValue);
     }
+
     var spellChecker = Components.classes["@mozilla.org/spellchecker/engine;1"]
                                  .getService(Components.interfaces.mozISpellCheckingEngine);
     var o1 = {};
     spellChecker.getDictionaryList(o1, {});
     var dictList = o1.value;
     // If the preference contains an invalid dictionary, set it to a valid
     // dictionary, any dictionary will do.
     if (dictList.length && dictList.indexOf(prefValue) < 0)