Bug 1056322 - Don't run DictionaryFetcher when spllchecker isn't initialized. r?masayuki draft
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Wed, 12 Apr 2017 17:43:51 +0900
changeset 561688 eaba2e8de1d3a35e86f31a852b89295f85a1b309
parent 560921 f40e24f40b4c4556944c762d4764eace261297f5
child 624043 65b2ae03fbd0f043c8b04944fbf20e5ad3b6946d
push id53804
push userm_kato@ga2.so-net.ne.jp
push dateThu, 13 Apr 2017 01:33:20 +0000
reviewersmasayuki
bugs1056322
milestone55.0a1
Bug 1056322 - Don't run DictionaryFetcher when spllchecker isn't initialized. r?masayuki When CanSpellCheck isn't called yet, mSpellChecker won't be initialized. So we should check it before running DictionaryFetcher. I think that UpdateCurrentDictionary is called by OnFocus as long as nsEditorSpellCheck::InitSpellChecker isn't called. But I cannot find test case to reproduce this... MozReview-Commit-ID: 5H1pJ0AnX5X
editor/composer/nsEditorSpellCheck.cpp
--- a/editor/composer/nsEditorSpellCheck.cpp
+++ b/editor/composer/nsEditorSpellCheck.cpp
@@ -665,16 +665,20 @@ nsEditorSpellCheck::DeleteSuggestedWordL
   mSuggestedWordList.Clear();
   mSuggestedWordIndex = 0;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsEditorSpellCheck::UpdateCurrentDictionary(nsIEditorSpellCheckCallback* aCallback)
 {
+  if (NS_WARN_IF(!mSpellChecker)) {
+    return NS_ERROR_NOT_INITIALIZED;
+  }
+
   nsresult rv;
 
   RefPtr<nsEditorSpellCheck> kungFuDeathGrip = this;
 
   // Get language with html5 algorithm
   nsCOMPtr<nsIContent> rootContent;
   nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(mEditor);
   if (htmlEditor) {