Bug 1056322 - Don't run DictionaryFetcher when spllchecker isn't initialized. r=masayuki
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Wed, 12 Apr 2017 17:43:51 +0900
changeset 352778 c1357df217a49a99428622394234a52a50066e1f
parent 352777 cc1c8ee5af0ba2e561c005e41f14ab66dccf3085
child 352779 abfece312d7446cc88b410ad7d23eeb68d77b480
push id40653
push userm_kato@ga2.so-net.ne.jp
push dateThu, 13 Apr 2017 01:59:05 +0000
treeherderautoland@c1357df217a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1056322
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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) {