Bug 1448200 - Handle the creation of the spellchecker more gracefully. r=Felipe draft
authorBlake Kaplan <mrbkap@gmail.com>
Fri, 30 Mar 2018 16:15:11 -0700
changeset 775329 4adea9d748ff2bf821c101ed419c1412c41b1cf9
parent 775219 0405f6006f3a3f653dd42d587c3eefe08cffa37d
push id104702
push userbmo:mrbkap@mozilla.com
push dateFri, 30 Mar 2018 23:23:14 +0000
reviewersFelipe
bugs1448200
milestone61.0a1
Bug 1448200 - Handle the creation of the spellchecker more gracefully. r=Felipe If the user right-clicks on an input field and that click causes us to create a spellchecker, then it won't be initialized in time to show the context menu. Handle that case more gracefully by passing that state up to the parent. MozReview-Commit-ID: 1hjxloq2OLp
toolkit/modules/InlineSpellCheckerContent.jsm
--- a/toolkit/modules/InlineSpellCheckerContent.jsm
+++ b/toolkit/modules/InlineSpellCheckerContent.jsm
@@ -44,16 +44,22 @@ var InlineSpellCheckerContent = {
     }
 
     if (!spellChecker.mInlineSpellChecker.enableRealTimeSpell) {
       return { canSpellCheck: true,
                initialSpellCheckPending: spellChecker.initialSpellCheckPending,
                enableRealTimeSpell: false };
     }
 
+    if (spellChecker.initialSpellCheckPending) {
+      return { canSpellCheck: true,
+               initialSpellCheckPending: true,
+               enableRealTimeSpell: true };
+    }
+
     let dictionaryList = {};
     let realSpellChecker = spellChecker.mInlineSpellChecker.spellChecker;
     realSpellChecker.GetDictionaryList(dictionaryList, {});
 
     // The original list we get is in random order. We need our list to be
     // sorted by display names.
     dictionaryList = spellChecker.sortDictionaryList(dictionaryList.value).map((obj) => {
       return obj.id;