Bug 1056322 - Don't run DictionaryFetcher when spllchecker isn't initialized. r=masayuki, a=ritu
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Wed, 12 Apr 2017 17:43:51 +0900
changeset 355798 f076a30f6c291b7dfcda20a230ed910f373a3515
parent 355797 047f19a1b9a096fb12f2c28575e6603ad51f7b95
child 355799 28e09d4ac3e960e318d6d95546428ea5ba0aaf69
push id7086
push userryanvm@gmail.com
push dateThu, 11 May 2017 20:15:10 +0000
treeherdermozilla-esr52@0b855945ce34 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki, ritu
bugs1056322
milestone52.1.2
Bug 1056322 - Don't run DictionaryFetcher when spllchecker isn't initialized. r=masayuki, a=ritu 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
@@ -660,16 +660,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) {