Backed out 3 changesets (bug 1200533) for test failures in reftests/338427-2.html
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Tue, 08 Sep 2015 10:29:38 +0200
changeset 261303 2bb231870f2d4ac66fea59f40e8d3e893816803c
parent 261302 1af3c0789763f9ef2fb4af848b73c8ecb6a571de
child 261304 b23b2fa33a9dcda59dbbca1d157eca3c32c5b862
child 261323 2e38346f89af2e73dcb0b943fdf31b38b480e153
push id15075
push usercbook@mozilla.com
push dateTue, 08 Sep 2015 14:08:27 +0000
treeherderfx-team@20cc75c647f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1200533, 338427
milestone43.0a1
backs out9f3ca77e2d7b7fef9d201b02e9ae857d53194745
b3ad852a044adc38cdb1ac4b1da8d8768ad14498
74e6798a38a4de824660363017f3d83f9c91401a
Backed out 3 changesets (bug 1200533) for test failures in reftests/338427-2.html Backed out changeset 9f3ca77e2d7b (bug 1200533) Backed out changeset b3ad852a044a (bug 1200533) Backed out changeset 74e6798a38a4 (bug 1200533)
editor/composer/nsEditorSpellCheck.cpp
editor/composer/nsEditorSpellCheck.h
editor/composer/test/bug1200533_subframe.html
editor/composer/test/chrome.ini
editor/composer/test/de-DE/de_DE.aff
editor/composer/test/de-DE/de_DE.dic
editor/composer/test/en-AU/en_AU.aff
editor/composer/test/en-AU/en_AU.dic
editor/composer/test/mochitest.ini
editor/composer/test/test_bug1200533.html
editor/composer/test/test_bug678842.html
editor/composer/test/test_bug717433.html
--- a/editor/composer/nsEditorSpellCheck.cpp
+++ b/editor/composer/nsEditorSpellCheck.cpp
@@ -585,56 +585,42 @@ NS_IMETHODIMP
 nsEditorSpellCheck::SetCurrentDictionary(const nsAString& aDictionary)
 {
   NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED);
 
   nsRefPtr<nsEditorSpellCheck> kungFuDeathGrip = this;
 
   // The purpose of mUpdateDictionaryRunning is to avoid doing all of this if
   // UpdateCurrentDictionary's helper method DictionaryFetched, which calls us,
-  // is on the stack. In other words: Only do this, if the user manually selected a
-  // dictionary to use.
+  // is on the stack.
   if (!mUpdateDictionaryRunning) {
 
     // Ignore pending dictionary fetchers by increasing this number.
     mDictionaryFetcherGroup++;
 
     uint32_t flags = 0;
     mEditor->GetFlags(&flags);
     if (!(flags & nsIPlaintextEditor::eEditorMailMask)) {
-      if (mPreferredLang.IsEmpty() ||
-          !mPreferredLang.Equals(aDictionary, nsCaseInsensitiveStringComparator())) {
+      if (mPreferredLang.IsEmpty() || !mPreferredLang.Equals(aDictionary)) {
         // When user sets dictionary manually, we store this value associated
         // with editor url, if it doesn't match the document language exactly.
         // For example on "en" sites, we need to store "en-GB", otherwise
         // the language might jump back to en-US although the user explicitly
         // chose otherwise.
         StoreCurrentDictionary(mEditor, aDictionary);
-#ifdef DEBUG_DICT
-        printf("***** Writing content preferences for |%s|\n",
-               NS_ConvertUTF16toUTF8(aDictionary).get());
-#endif
       } else {
         // If user sets a dictionary matching the language defined by
         // document, we consider content pref has been canceled, and we clear it.
         ClearCurrentDictionary(mEditor);
-#ifdef DEBUG_DICT
-        printf("***** Clearing content preferences for |%s|\n",
-               NS_ConvertUTF16toUTF8(aDictionary).get());
-#endif
       }
 
-      // Also store it in as a preference, so we can use it as a fallback.
-      // We don't want this for mail composer because it uses
-      // "spellchecker.dictionary" as a preference.
+      // Also store it in as a preference. It will be used as a default value
+      // when everything else fails but we don't want this for mail composer
+      // because it has spellchecked dictionary settings in Preferences.
       Preferences::SetString("spellchecker.dictionary", aDictionary);
-#ifdef DEBUG_DICT
-      printf("***** Storing spellchecker.dictionary |%s|\n",
-             NS_ConvertUTF16toUTF8(aDictionary).get());
-#endif
     }
   }
   return mSpellChecker->SetCurrentDictionary(aDictionary);
 }
 
 NS_IMETHODIMP
 nsEditorSpellCheck::CheckCurrentDictionary()
 {
@@ -732,54 +718,16 @@ nsEditorSpellCheck::UpdateCurrentDiction
   doc->GetContentLanguage(fetcher->mRootDocContentLang);
 
   rv = fetcher->Fetch(mEditor);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
-// Helper function that iterates over the list of dictionaries and sets the one
-// that matches based on a given comparison type.
-nsresult
-nsEditorSpellCheck::TryDictionary(nsAutoString aDictName,
-                                  nsTArray<nsString>& aDictList,
-                                  enum dictCompare aCompareType)
-{
-  nsresult rv = NS_ERROR_NOT_AVAILABLE;
-
-  for (uint32_t i = 0; i < aDictList.Length(); i++) {
-    nsAutoString dictStr(aDictList.ElementAt(i));
-    bool equals = false;
-    switch (aCompareType) {
-      case DICT_NORMAL_COMPARE:
-        equals = aDictName.Equals(dictStr);
-        break;
-      case DICT_COMPARE_CASE_INSENSITIVE:
-        equals = aDictName.Equals(dictStr, nsCaseInsensitiveStringComparator());
-        break;
-      case DICT_COMPARE_DASHMATCH:
-        equals = nsStyleUtil::DashMatchCompare(dictStr, aDictName, nsCaseInsensitiveStringComparator());
-        break;
-    }
-    if (equals) {
-      rv = SetCurrentDictionary(dictStr);
-#ifdef DEBUG_DICT
-      if (NS_SUCCEEDED(rv))
-        printf("***** Set |%s|.\n", NS_ConvertUTF16toUTF8(dictStr).get());
-#endif
-      // We always break here. We tried to set the dictionary to an existing
-      // dictionary from the list. This must work, if it doesn't, there is
-      // no point trying another one.
-      break;
-    }
-  }
-  return rv;
-}
-
 nsresult
 nsEditorSpellCheck::DictionaryFetched(DictionaryFetcher* aFetcher)
 {
   MOZ_ASSERT(aFetcher);
   nsRefPtr<nsEditorSpellCheck> kungFuDeathGrip = this;
 
   // Important: declare the holder after the callback caller so that the former
   // is destructed first so that it's not active when the callback is called.
@@ -787,234 +735,154 @@ nsEditorSpellCheck::DictionaryFetched(Di
   UpdateDictionaryHolder holder(this);
 
   if (aFetcher->mGroup < mDictionaryFetcherGroup) {
     // SetCurrentDictionary was called after the fetch started.  Don't overwrite
     // that dictionary with the fetched one.
     return NS_OK;
   }
 
-  /*
-   * We try to derive the dictionary to use based on the following priorities:
-   * 1) Content preference, so the language the user set for the site before.
-   *    (Introduced in bug 678842 and corrected in bug 717433.)
-   * 2) Language set by the website, or any other dictionary that partly
-   *    matches that. (Introduced in bug 338427.)
-   *    Eg. if the website is "en-GB", a user who only has "en-US" will get
-   *    that. If the website is generic "en", the user will get one of the
-   *    "en-*" installed, (almost) at random.
-   *    However, we prefer what is stored in "spellchecker.dictionary",
-   *    so if the user chose "en-AU" before, they will get "en-AU" on a plain
-   *    "en" site. (Introduced in bug 682564.)
-   * 3) The value of "spellchecker.dictionary" which reflects a previous
-   *    language choice of the user (on another site).
-   *    (This was the original behaviour before the aforementioned bugs
-   *    landed).
-   * 4) The user's locale.
-   * 5) Use the current dictionary that is currently set.
-   * 6) The content of the "LANG" environment variable (if set).
-   * 7) The first spell check dictionary installed.
-   */
+  mPreferredLang.Assign(aFetcher->mRootContentLang);
 
-  // Get the language from the element or its closest parent according to:
-  // https://html.spec.whatwg.org/#attr-lang
-  // This is used in SetCurrentDictionary.
-  mPreferredLang.Assign(aFetcher->mRootContentLang);
-#ifdef DEBUG_DICT
-  printf("***** mPreferredLang (element) |%s|\n",
-         NS_ConvertUTF16toUTF8(mPreferredLang).get());
-#endif
-
-  // If no luck, try the "Content-Language" header.
-  if (mPreferredLang.IsEmpty()) {
-    mPreferredLang.Assign(aFetcher->mRootDocContentLang);
-#ifdef DEBUG_DICT
-    printf("***** mPreferredLang (content-language) |%s|\n",
-           NS_ConvertUTF16toUTF8(mPreferredLang).get());
-#endif
-  }
-
-  // Priority 1:
   // If we successfully fetched a dictionary from content prefs, do not go
   // further. Use this exact dictionary.
   // Don't use content preferences for editor with eEditorMailMask flag.
   nsAutoString dictName;
   uint32_t flags;
   mEditor->GetFlags(&flags);
   if (!(flags & nsIPlaintextEditor::eEditorMailMask)) {
     dictName.Assign(aFetcher->mDictionary);
     if (!dictName.IsEmpty()) {
-      if (NS_SUCCEEDED(SetCurrentDictionary(dictName))) {
-#ifdef DEBUG_DICT
-        printf("***** Assigned from content preferences |%s|\n",
-               NS_ConvertUTF16toUTF8(dictName).get());
-#endif
-
-        // We take an early exit here, so let's not forget to clear the word
-        // list.
-        DeleteSuggestedWordList();
-        return NS_OK;
+      if (NS_FAILED(SetCurrentDictionary(dictName))) {
+        // May be dictionary was uninstalled ?
+        ClearCurrentDictionary(mEditor);
       }
-      // May be dictionary was uninstalled ?
-      // Clear the content preference and continue.
-      ClearCurrentDictionary(mEditor);
+      return NS_OK;
     }
   }
 
-  // Priority 2:
-  // After checking the content preferences, we use the language of the element
-  // or document.
-  dictName.Assign(mPreferredLang);
-#ifdef DEBUG_DICT
-  printf("***** Assigned from element/doc |%s|\n",
-         NS_ConvertUTF16toUTF8(dictName).get());
-#endif
+  if (mPreferredLang.IsEmpty()) {
+    mPreferredLang.Assign(aFetcher->mRootDocContentLang);
+  }
 
-  // Auxiliary status.
-  nsresult rv2;
+  // Then, try to use language computed from element
+  if (!mPreferredLang.IsEmpty()) {
+    dictName.Assign(mPreferredLang);
+  }
 
-  // We obtain a list of available dictionaries.
-  nsTArray<nsString> dictList;
-  rv2 = mSpellChecker->GetDictionaryList(&dictList);
-  NS_ENSURE_SUCCESS(rv2, rv2);
+  // otherwise, get language from preferences
+  nsAutoString preferedDict(Preferences::GetLocalizedString("spellchecker.dictionary"));
+  if (dictName.IsEmpty()) {
+    dictName.Assign(preferedDict);
+  }
 
-  // Get the preference value.
-  nsAutoString preferredDict;
-  preferredDict = Preferences::GetLocalizedString("spellchecker.dictionary");
+  nsresult rv = NS_OK;
+  if (dictName.IsEmpty()) {
+    // Prefs didn't give us a dictionary name, so just get the current
+    // locale and use that as the default dictionary name!
 
-  // The following will be driven by this status. Once we were able to set a
-  // dictionary successfully, we're done. So we start with a "failed" status.
-  nsresult rv = NS_ERROR_NOT_AVAILABLE;
+    nsCOMPtr<nsIXULChromeRegistry> packageRegistry =
+      mozilla::services::GetXULChromeRegistryService();
 
-  if (!dictName.IsEmpty()) {
-    // RFC 5646 explicitly states that matches should be case-insensitive.
-    rv = TryDictionary (dictName, dictList, DICT_COMPARE_CASE_INSENSITIVE);
+    if (packageRegistry) {
+      nsAutoCString utf8DictName;
+      rv = packageRegistry->GetSelectedLocale(NS_LITERAL_CSTRING("global"),
+                                              utf8DictName);
+      AppendUTF8toUTF16(utf8DictName, dictName);
+    }
+  }
 
+  if (NS_SUCCEEDED(rv) && !dictName.IsEmpty()) {
+    rv = SetCurrentDictionary(dictName);
     if (NS_FAILED(rv)) {
-#ifdef DEBUG_DICT
-      printf("***** Setting of |%s| failed (or it wasn't available)\n",
-             NS_ConvertUTF16toUTF8(dictName).get());
-#endif
+      // required dictionary was not available. Try to get a dictionary
+      // matching at least language part of dictName:
 
-      // Required dictionary was not available. Try to get a dictionary
-      // matching at least language part of dictName.
       nsAutoString langCode;
       int32_t dashIdx = dictName.FindChar('-');
       if (dashIdx != -1) {
         langCode.Assign(Substring(dictName, 0, dashIdx));
       } else {
         langCode.Assign(dictName);
       }
 
-      // Try dictionary.spellchecker preference, if it starts with langCode,
-      // so we don't just get any random dictionary matching the language.
-      if (!preferredDict.IsEmpty() &&
-          nsStyleUtil::DashMatchCompare(preferredDict, langCode, nsDefaultStringComparator())) {
-#ifdef DEBUG_DICT
-        printf("***** Trying preference value |%s| since it matches language code\n",
-               NS_ConvertUTF16toUTF8(preferredDict).get());
-#endif
-        rv = TryDictionary (preferredDict, dictList,
-                            DICT_COMPARE_CASE_INSENSITIVE);
+      nsDefaultStringComparator comparator;
+
+      // try dictionary.spellchecker preference if it starts with langCode (and
+      // if we haven't tried it already)
+      if (!preferedDict.IsEmpty() && !dictName.Equals(preferedDict) &&
+          nsStyleUtil::DashMatchCompare(preferedDict, langCode, comparator)) {
+        rv = SetCurrentDictionary(preferedDict);
+      }
+
+      // Otherwise, try langCode (if we haven't tried it already)
+      if (NS_FAILED(rv)) {
+        if (!dictName.Equals(langCode) && !preferedDict.Equals(langCode)) {
+          rv = SetCurrentDictionary(langCode);
+        }
       }
 
+      // Otherwise, try any available dictionary aa-XX
       if (NS_FAILED(rv)) {
-        // Use any dictionary with the required language.
-#ifdef DEBUG_DICT
-        printf("***** Trying to find match for language code |%s|\n",
-               NS_ConvertUTF16toUTF8(langCode).get());
-#endif
-        rv = TryDictionary (langCode, dictList, DICT_COMPARE_DASHMATCH);
+        // loop over avaible dictionaries; if we find one with required
+        // language, use it
+        nsTArray<nsString> dictList;
+        rv = mSpellChecker->GetDictionaryList(&dictList);
+        NS_ENSURE_SUCCESS(rv, rv);
+        int32_t i, count = dictList.Length();
+        for (i = 0; i < count; i++) {
+          nsAutoString dictStr(dictList.ElementAt(i));
+
+          if (dictStr.Equals(dictName) ||
+              dictStr.Equals(preferedDict) ||
+              dictStr.Equals(langCode)) {
+            // We have already tried it
+            continue;
+          }
+          if (nsStyleUtil::DashMatchCompare(dictStr, langCode, comparator) &&
+              NS_SUCCEEDED(SetCurrentDictionary(dictStr))) {
+              break;
+          }
+        }
       }
     }
   }
 
-  // Priority 3:
-  // If the document didn't supply a dictionary or the setting failed,
-  // try the user preference next.
-  if (NS_FAILED(rv)) {
-    if (!preferredDict.IsEmpty()) {
-#ifdef DEBUG_DICT
-      printf("***** Trying preference value |%s|\n",
-             NS_ConvertUTF16toUTF8(preferredDict).get());
-#endif
-      rv = TryDictionary (preferredDict, dictList, DICT_NORMAL_COMPARE);
-    }
-  }
-
-  // Priority 4:
-  // As next fallback, try the current locale.
-  if (NS_FAILED(rv)) {
-    nsCOMPtr<nsIXULChromeRegistry> packageRegistry =
-      mozilla::services::GetXULChromeRegistryService();
-
-    if (packageRegistry) {
-      nsAutoCString utf8DictName;
-      rv2 = packageRegistry->GetSelectedLocale(NS_LITERAL_CSTRING("global"),
-                                               utf8DictName);
-      dictName.Assign(EmptyString());
-      AppendUTF8toUTF16(utf8DictName, dictName);
-#ifdef DEBUG_DICT
-      printf("***** Trying locale |%s|\n",
-             NS_ConvertUTF16toUTF8(dictName).get());
-#endif
-      rv = TryDictionary (dictName, dictList, DICT_COMPARE_CASE_INSENSITIVE);
-    }
-  }
-
-  if (NS_FAILED(rv)) {
-  // Still no success.
-
-  // Priority 5:
-  // If we have a current dictionary, don't try anything else.
+  // If we have not set dictionary, and the editable element doesn't have a
+  // lang attribute, we try to get a dictionary. First try LANG environment variable,
+  // then en-US. If it does not work, pick the first one.
+  if (mPreferredLang.IsEmpty()) {
     nsAutoString currentDictionary;
-    rv2 = GetCurrentDictionary(currentDictionary);
-#ifdef DEBUG_DICT
-    if (NS_SUCCEEDED(rv2))
-        printf("***** Retrieved current dict |%s|\n",
-               NS_ConvertUTF16toUTF8(currentDictionary).get());
-#endif
-
-    if (NS_FAILED(rv2) || currentDictionary.IsEmpty()) {
-      // Priority 6:
-      // Try to get current dictionary from environment variable LANG.
-      // LANG = language[_territory][.charset]
+    rv = GetCurrentDictionary(currentDictionary);
+    if (NS_FAILED(rv) || currentDictionary.IsEmpty()) {
+      // Try to get current dictionary from environment variable LANG
       char* env_lang = getenv("LANG");
       if (env_lang != nullptr) {
         nsString lang = NS_ConvertUTF8toUTF16(env_lang);
-        // Strip trailing charset, if there is any.
+        // Strip trailing charset if there is any
         int32_t dot_pos = lang.FindChar('.');
         if (dot_pos != -1) {
           lang = Substring(lang, 0, dot_pos);
         }
-
-        int32_t underScore = lang.FindChar('_');
-        if (underScore != -1) {
-          lang.Replace(underScore, 1, '-');
-#ifdef DEBUG_DICT
-          printf("***** Trying LANG from environment |%s|\n",
-                 NS_ConvertUTF16toUTF8(lang).get());
-#endif
-          nsAutoString lang2;
-          lang2.Assign(lang);
-          rv = TryDictionary(lang2, dictList, DICT_COMPARE_CASE_INSENSITIVE);
+        if (NS_FAILED(rv)) {
+          int32_t underScore = lang.FindChar('_');
+          if (underScore != -1) {
+            lang.Replace(underScore, 1, '-');
+            rv = SetCurrentDictionary(lang);
+          }
         }
       }
-
-      // Priority 7:
-      // If it does not work, pick the first one.
       if (NS_FAILED(rv)) {
-        if (dictList.Length() > 0) {
-          rv = SetCurrentDictionary(dictList[0]);
-#ifdef DEBUG_DICT
-          printf("***** Trying first of list |%s|\n",
-                 NS_ConvertUTF16toUTF8(dictList[0]).get());
-          if (NS_SUCCEEDED(rv))
-            printf ("***** Setting worked.\n");
-#endif
+        rv = SetCurrentDictionary(NS_LITERAL_STRING("en-US"));
+        if (NS_FAILED(rv)) {
+          nsTArray<nsString> dictList;
+          rv = mSpellChecker->GetDictionaryList(&dictList);
+          if (NS_SUCCEEDED(rv) && dictList.Length() > 0) {
+            SetCurrentDictionary(dictList[0]);
+          }
         }
       }
     }
   }
 
   // If an error was thrown while setting the dictionary, just
   // fail silently so that the spellchecker dialog is allowed to come
   // up. The user can manually reset the language to their choice on
--- a/editor/composer/nsEditorSpellCheck.h
+++ b/editor/composer/nsEditorSpellCheck.h
@@ -22,22 +22,16 @@ class nsITextServicesFilter;
 #define NS_EDITORSPELLCHECK_CID                     \
 { /* {75656ad9-bd13-4c5d-939a-ec6351eea0cc} */        \
     0x75656ad9, 0xbd13, 0x4c5d,                       \
     { 0x93, 0x9a, 0xec, 0x63, 0x51, 0xee, 0xa0, 0xcc }\
 }
 
 class DictionaryFetcher;
 
-enum dictCompare {
-  DICT_NORMAL_COMPARE,
-  DICT_COMPARE_CASE_INSENSITIVE,
-  DICT_COMPARE_DASHMATCH
-};
-
 class nsEditorSpellCheck final : public nsIEditorSpellCheck
 {
   friend class DictionaryFetcher;
 
 public:
   nsEditorSpellCheck();
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@@ -65,19 +59,16 @@ protected:
   nsCOMPtr<nsIEditor> mEditor;
 
   nsString mPreferredLang;
 
   uint32_t mDictionaryFetcherGroup;
 
   bool mUpdateDictionaryRunning;
 
-  nsresult TryDictionary(nsAutoString aDictName, nsTArray<nsString>& aDictList,
-                         enum dictCompare aCompareType);
-
   nsresult DictionaryFetched(DictionaryFetcher* aFetchState);
 
 public:
   void BeginUpdateDictionary() { mUpdateDictionaryRunning = true ;}
   void EndUpdateDictionary() { mUpdateDictionaryRunning = false ;}
 };
 
 #endif // nsEditorSpellCheck_h___
deleted file mode 100644
--- a/editor/composer/test/bug1200533_subframe.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta http-equiv="Content-Language" content="en-US">
-</head>
-<body>
-<textarea id="none">root en-US</textarea>
-<textarea id="en-GB" lang="en-GB">root en-US, but element en-GB</textarea>
-<textarea id="en-gb" lang="en-gb">root en-US, but element en-gb (lower case)</textarea>
-<textarea id="en-ZA-not-avail" lang="en-ZA">root en-US, but element en-ZA (which is not installed)</textarea>
-<textarea id="en-generic" lang="en">root en-US, but element en</textarea>
-<textarea id="ko-not-avail" lang="ko">root en-US, but element ko (which is not installed)</textarea>
-</body>
-</html>
--- a/editor/composer/test/chrome.ini
+++ b/editor/composer/test/chrome.ini
@@ -1,9 +1,8 @@
 [DEFAULT]
 skip-if = buildapp == 'b2g' || os == 'android'
 
 [test_async_UpdateCurrentDictionary.html]
 [test_bug338427.html]
 [test_bug434998.xul]
 [test_bug678842.html]
 [test_bug717433.html]
-[test_bug1200533.html]
deleted file mode 100644
--- a/editor/composer/test/de-DE/de_DE.aff
+++ /dev/null
@@ -1,2 +0,0 @@
-# Affix file for German English dictionary
-# Fake file, nothing here.
deleted file mode 100644
--- a/editor/composer/test/de-DE/de_DE.dic
+++ /dev/null
@@ -1,4 +0,0 @@
-3
-Mary
-Paul
-Peter
deleted file mode 100644
--- a/editor/composer/test/en-AU/en_AU.aff
+++ /dev/null
@@ -1,2 +0,0 @@
-# Affix file for British English dictionary
-# Fake file, nothing here.
deleted file mode 100644
--- a/editor/composer/test/en-AU/en_AU.dic
+++ /dev/null
@@ -1,4 +0,0 @@
-3
-Mary
-Paul
-Peter
--- a/editor/composer/test/mochitest.ini
+++ b/editor/composer/test/mochitest.ini
@@ -1,19 +1,14 @@
 [DEFAULT]
 skip-if = buildapp == 'b2g' || buildapp == 'mulet'
 support-files =
   bug678842_subframe.html
   bug717433_subframe.html
-  bug1200533_subframe.html
   en-GB/en_GB.dic
   en-GB/en_GB.aff
-  en-AU/en_AU.dic
-  en-AU/en_AU.aff
-  de-DE/de_DE.dic
-  de-DE/de_DE.aff
 
 [test_bug348497.html]
 [test_bug384147.html]
 [test_bug389350.html]
 skip-if = toolkit == 'android'
 [test_bug519928.html]
 [test_bug738440.html]
deleted file mode 100644
--- a/editor/composer/test/test_bug1200533.html
+++ /dev/null
@@ -1,134 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1200533
--->
-<head>
-  <title>Test for Bug 1200533</title>
-  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1200533">Mozilla Bug 1200533</a>
-<p id="display"></p>
-<iframe id="content"></iframe>
-
-</div>
-<pre id="test">
-<script class="testbody" ttype="application/javascript">
-
-/** Test for Bug 1200533 **/
-/** Visit the elements defined above and check the dictionary we got **/
-SimpleTest.waitForExplicitFinish();
-var content = document.getElementById('content');
-
-var tests = [
-    // text area, value of spellchecker.dictionary, result.
-    // Result: Document language.
-    [ "none",  "", "en-US" ],
-    // Result: Element language.
-    [ "en-GB", "", "en-GB" ],
-    [ "en-gb", "", "en-GB" ],
-    // Result: Random en-*.
-    [ "en-ZA-not-avail", "", "*" ],
-    [ "en-generic",      "", "*" ],
-    // Result: Locale.
-    [ "ko-not-avail",    "", "en-US" ],
-
-    // Result: Preference value in all cases.
-    [ "en-ZA-not-avail", "en-AU", "en-AU" ],
-    [ "en-generic",      "en-AU", "en-AU" ],
-    [ "ko-not-avail",    "en-AU", "en-AU" ],
-
-    // Result: Random en-*.
-    [ "en-ZA-not-avail", "de-DE", "*" ],
-    [ "en-generic",      "de-DE", "*" ],
-    // Result: Preference value.
-    [ "ko-not-avail",    "de-DE", "de-DE" ],
-  ];
-
-var loadCount = 0;
-var en_GB;
-var en_AU;
-var en_DE;
-var hunspell;
-
-var loadListener = function(evt) {
-  Components.utils.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm");
-  Components.utils.import("resource://gre/modules/Services.jsm");
-
-  if (loadCount == 0) {
-    var dir = Components.classes["@mozilla.org/file/directory_service;1"]
-                        .getService(Components.interfaces.nsIProperties)
-                        .get("CurWorkD", Components.interfaces.nsIFile);
-    dir.append("tests");
-    dir.append("editor");
-    dir.append("composer");
-    dir.append("test");
-
-    hunspell = Components.classes["@mozilla.org/spellchecker/engine;1"]
-                         .getService(Components.interfaces.mozISpellCheckingEngine);
-
-    // Install en-GB, en-AU and de-DE dictionaries.
-    en_GB = dir.clone();
-    en_AU = dir.clone();
-    de_DE = dir.clone();
-    en_GB.append("en-GB");
-    en_AU.append("en-AU");
-    de_DE.append("de-DE");
-    is(en_GB.exists(), true, "true expected (en-GB directory should exist)");
-    is(en_AU.exists(), true, "true expected (en-AU directory should exist)");
-    is(de_DE.exists(), true, "true expected (de-DE directory should exist)");
-    hunspell.addDirectory(en_GB);
-    hunspell.addDirectory(en_AU);
-    hunspell.addDirectory(de_DE);
-  }
-
-  Services.prefs.setCharPref("spellchecker.dictionary", tests[loadCount][1]);
-
-  var doc = evt.target.contentDocument;
-  var elem = doc.getElementById(tests[loadCount][0]);
-  var editor = elem.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor;
-  editor.setSpellcheckUserOverride(true);
-  var inlineSpellChecker = editor.getInlineSpellChecker(true);
-
-  onSpellCheck(elem, function () {
-    var spellchecker = inlineSpellChecker.spellChecker;
-    try {
-      var dict = spellchecker.GetCurrentDictionary();
-    } catch(e) {}
-
-    if (tests[loadCount][2] != "*") {
-      is (dict, tests[loadCount][2], "expected " + tests[loadCount][2]);
-    } else {
-      var gotEn = (dict == "en-GB" || dict == "en-AU" || dict == "en-US");
-      is (gotEn, true, "expected en-AU or en-GB or en-US");
-    }
-
-    loadCount++;
-    if (loadCount < tests.length) {
-      // Load the iframe again.
-      content.src = 'http://mochi.test:8888/tests/editor/composer/test/bug1200533_subframe.html?firstload=false';
-    } else {
-      // Remove the fake  dictionaries again, since it's otherwise picked up by later tests.
-      hunspell.removeDirectory(en_GB);
-      hunspell.removeDirectory(en_AU);
-      hunspell.removeDirectory(de_DE);
-
-      // Reset the preference, so the last value we set doesn't collide with the next test.
-      Services.prefs.setCharPref("spellchecker.dictionary", "");
-
-      SimpleTest.finish();
-    }
-  });
-
-}
-
-content.addEventListener('load', loadListener, false);
-
-content.src = 'http://mochi.test:8888/tests/editor/composer/test/bug1200533_subframe.html?firstload=true';
-
-</script>
-</pre>
-</body>
-</html>
--- a/editor/composer/test/test_bug678842.html
+++ b/editor/composer/test/test_bug678842.html
@@ -3,17 +3,16 @@
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=678842
 -->
 <head>
   <title>Test for Bug 678842</title>
   <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 </head>
-<body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=678842">Mozilla Bug 678842</a>
 <p id="display"></p>
 <iframe id="content"></iframe>
   
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
@@ -21,42 +20,19 @@ https://bugzilla.mozilla.org/show_bug.cg
 SimpleTest.waitForExplicitFinish();
 var content = document.getElementById('content');
 // load a subframe containing an editor with a defined unknown lang. At first
 // load, it will set dictionary to en-US. At second load, it will return current
 // dictionary. So, we can check, dictionary is correctly remembered between
 // loads.
 
 var firstLoad = true;
-var en_GB;
-var hunspell;
 
 var loadListener = function(evt) {
   Components.utils.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm");
-  Components.utils.import("resource://gre/modules/Services.jsm");
-
-  if (firstLoad) {
-    var dir = Components.classes["@mozilla.org/file/directory_service;1"]
-                        .getService(Components.interfaces.nsIProperties)
-                        .get("CurWorkD", Components.interfaces.nsIFile);
-    dir.append("tests");
-    dir.append("editor");
-    dir.append("composer");
-    dir.append("test");
-
-    hunspell = Components.classes["@mozilla.org/spellchecker/engine;1"]
-                         .getService(Components.interfaces.mozISpellCheckingEngine);
-
-    // Install en-GB dictionary.
-    en_GB = dir.clone();
-    en_GB.append("en-GB");
-    is(en_GB.exists(), true, "true expected (en-GB directory should exist)");
-    hunspell.addDirectory(en_GB);
-  }
-
   var doc = evt.target.contentDocument;
   var elem = doc.getElementById('textarea');
   var editor = elem.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor;
   editor.setSpellcheckUserOverride(true);
   var inlineSpellChecker = editor.getInlineSpellChecker(true);
 
   onSpellCheck(elem, function () {
     var spellchecker = inlineSpellChecker.spellChecker;
@@ -65,33 +41,21 @@ var loadListener = function(evt) {
     } catch(e) {}
 
     if (!currentDictonary) {
       spellchecker.SetCurrentDictionary('en-US');
     }
 
     if (firstLoad) {
       firstLoad = false;
-
-       // First time around, the dictionary defaults to the locale.
-      is (currentDictonary, "en-US", "unexpected lang " + currentDictonary + " instead of en-US");
-
-      // Select en-GB.
-      spellchecker.SetCurrentDictionary("en-GB");
-
+      is (currentDictonary, "", "unexpected lang " + currentDictonary);
       content.src = 'http://mochi.test:8888/tests/editor/composer/test/bug678842_subframe.html?firstload=false';
     } else {
-      is (currentDictonary, "en-GB", "unexpected lang " + currentDictonary + " instead of en-GB");
+      is (currentDictonary, "en-US", "unexpected lang " + currentDictonary + " instead of en-US");
       content.removeEventListener('load', loadListener, false);
-
-      // Remove the fake en-GB dictionary again, since it's otherwise picked up by later tests.
-      hunspell.removeDirectory(en_GB);
-
-      // Reset the preference, so the last value we set doesn't collide with the next test.
-      Services.prefs.setCharPref("spellchecker.dictionary", "");
       SimpleTest.finish();
     }
   });
 }
 
 content.addEventListener('load', loadListener, false);
 
 content.src = 'http://mochi.test:8888/tests/editor/composer/test/bug678842_subframe.html?firstload=true';
--- a/editor/composer/test/test_bug717433.html
+++ b/editor/composer/test/test_bug717433.html
@@ -3,17 +3,16 @@
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=717433
 -->
 <head>
   <title>Test for Bug 717433</title>
   <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 </head>
-<body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=717433">Mozilla Bug 717433</a>
 <p id="display"></p>
 <iframe id="content"></iframe>
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
@@ -27,17 +26,16 @@ var content = document.getElementById('c
 
 var firstLoad = true;
 var expected = "";
 var en_GB;
 var hunspell;
 
 var loadListener = function(evt) {
   Components.utils.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm");
-  Components.utils.import("resource://gre/modules/Services.jsm");
 
   if (firstLoad) {
     var dir = Components.classes["@mozilla.org/file/directory_service;1"]
                         .getService(Components.interfaces.nsIProperties)
                         .get("CurWorkD", Components.interfaces.nsIFile);
     dir.append("tests");
     dir.append("editor");
     dir.append("composer");
@@ -80,19 +78,16 @@ var loadListener = function(evt) {
       }
       content.src = 'http://mochi.test:8888/tests/editor/composer/test/bug717433_subframe.html?firstload=false';
     } else {
       is(currentDictonary, expected, expected + " expected");
       content.removeEventListener('load', loadListener, false);
 
       // Remove the fake en-GB dictionary again, since it's otherwise picked up by later tests.
       hunspell.removeDirectory(en_GB);
-
-      // Reset the preference, so the last value we set doesn't collide with the next test.
-      Services.prefs.setCharPref("spellchecker.dictionary", "");
       SimpleTest.finish();
     }
   });
 }
 
 content.addEventListener('load', loadListener, false);
 
 content.src = 'http://mochi.test:8888/tests/editor/composer/test/bug717433_subframe.html?firstload=true';