Bug 1444630 - Don't update dictionary after calling UninitSpellChecker. r=masayuki
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Tue, 20 Mar 2018 14:27:06 +0900
changeset 462712 e8640719c6f96ddf8c5b8fd82dd1d6806dd3624f
parent 462711 37d5fb897e8bcbbcb65a645b7c340e93865a29ff
child 462713 e636edf00e6fbdc3206c9df4a1548ae38b3d13fa
child 462767 b75502c0debce9f2618840c4418269c8f8ac91eb
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1444630
milestone61.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 1444630 - Don't update dictionary after calling UninitSpellChecker. r=masayuki When calling UninitSpellChecker during calling UpdateDictionary, this crash occurs. Since Thunderbird calls UninitSpellChecker by [Recheck Text] button, this only occurs on Thunderbird. After calling UninitSpellChecker, we should not update dictionary. MozReview-Commit-ID: K4SPJ5FDo8n
editor/libeditor/crashtests/1444630.html
editor/libeditor/crashtests/crashtests.list
editor/spellchecker/EditorSpellCheck.cpp
new file mode 100644
--- /dev/null
+++ b/editor/libeditor/crashtests/1444630.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+<script type="text/javascript">
+function load()
+{
+  let textarea = document.getElementById("editor");
+  textarea.focus();
+
+  SpecialPowers.Cu.import(
+    "chrome://reftest/content/AsyncSpellCheckTestHelper.jsm")
+  .onSpellCheck(textarea, () => {
+    let isc = SpecialPowers.wrap(textarea).editor.getInlineSpellChecker(false);
+    let sc = isc.spellChecker;
+
+    textarea.setAttribute("lang", "en-US");
+    sc.UpdateCurrentDictionary(() => {
+      document.documentElement.classList.remove("reftest-wait");
+    });
+    sc.UninitSpellChecker();
+  });
+}
+</script>
+</head>
+<body onload="load()">
+<textarea id="editor" spellchecker="true">ABC</textarea>
+</body>
+</html>
--- a/editor/libeditor/crashtests/crashtests.list
+++ b/editor/libeditor/crashtests/crashtests.list
@@ -93,9 +93,10 @@ load 1402469.html
 load 1402526.html
 load 1402904.html
 load 1405747.html
 load 1408170.html
 load 1414581.html
 load 1415231.html
 load 1425091.html
 load 1443664.html
+skip-if(Android) needs-focus load 1444630.html
 load 1446451.html
--- a/editor/spellchecker/EditorSpellCheck.cpp
+++ b/editor/spellchecker/EditorSpellCheck.cpp
@@ -693,16 +693,17 @@ NS_IMETHODIMP
 EditorSpellCheck::UninitSpellChecker()
 {
   NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED);
 
   // Cleanup - kill the spell checker
   DeleteSuggestedWordList();
   mDictionaryList.Clear();
   mDictionaryIndex = 0;
+  mDictionaryFetcherGroup++;
   mSpellChecker = nullptr;
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 EditorSpellCheck::SetFilter(nsITextServicesFilter *aFilter)
 {