Bug 1504913 - Part 2. Get rid of nsISpellChecker. r=masayuki
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Tue, 06 Nov 2018 12:32:04 +0900
changeset 444693 b3888d4eeaa3b1e9394c6b21393a3bd27fddbd9f
parent 444692 6a089fb17fe6f8039ecd0b071492edd489a2c0a0
child 444801 64e32a13c4826d10460564ee555cf8e956a7891d
push id109635
push userm_kato@ga2.so-net.ne.jp
push dateWed, 07 Nov 2018 07:58:02 +0000
treeherdermozilla-inbound@b3888d4eeaa3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1504913
milestone65.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 1504913 - Part 2. Get rid of nsISpellChecker. r=masayuki No one uses nsISpellChecker, so let's get rid of nsISpellChecker. Differential Revision: https://phabricator.services.mozilla.com/D10994
editor/nsIEditorSpellCheck.idl
editor/spellchecker/moz.build
editor/spellchecker/nsISpellChecker.h
extensions/spellcheck/src/mozSpellChecker.cpp
extensions/spellcheck/src/mozSpellChecker.h
--- a/editor/nsIEditorSpellCheck.idl
+++ b/editor/nsIEditorSpellCheck.idl
@@ -29,98 +29,98 @@ interface nsIEditorSpellCheck : nsISuppo
   void          InitSpellChecker(in nsIEditor editor, in boolean enableSelectionChecking,
                                  [optional] in nsIEditorSpellCheckCallback callback);
 
   /**
    * When interactively spell checking the document, this will return the
    * value of the next word that is misspelled. This also computes the
    * suggestions which you can get by calling GetSuggestedWord.
    *
-   * @see nsISpellChecker::GetNextMisspelledWord
+   * @see mozSpellChecker::GetNextMisspelledWord
    */
   AString       GetNextMisspelledWord();
 
   /**
    * Used to get suggestions for the last word that was checked and found to
    * be misspelled. The first call will give you the first (best) suggestion.
    * Subsequent calls will iterate through all the suggestions, allowing you
    * to build a list. When there are no more suggestions, an empty string
    * (not a null pointer) will be returned.
    *
-   * @see nsISpellChecker::GetSuggestedWord
+   * @see mozSpellChecker::GetSuggestedWord
    */
   AString       GetSuggestedWord();
 
   /**
    * Check a given word. In spite of the name, this function checks the word
    * you give it, returning true if the word is misspelled. If the word is
    * misspelled, it will compute the suggestions which you can get from
    * GetSuggestedWord().
    *
-   * @see nsISpellChecker::CheckCurrentWord
+   * @see mozSpellChecker::CheckCurrentWord
    */
   boolean       CheckCurrentWord(in AString suggestedWord);
 
   /**
    * Use when modally checking the document to replace a word.
    *
-   * @see nsISpellChecker::CheckCurrentWord
+   * @see mozSpellChecker::CheckCurrentWord
    */
   void          ReplaceWord(in AString misspelledWord, in AString replaceWord, in boolean allOccurrences);
 
   /**
-   * @see nsISpellChecker::IgnoreAll
+   * @see mozSpellChecker::IgnoreAll
    */
   void          IgnoreWordAllOccurrences(in AString word);
 
   /**
    * Fills an internal list of words added to the personal dictionary. These
    * words can be retrieved using GetPersonalDictionaryWord()
    *
-   * @see nsISpellChecker::GetPersonalDictionary
+   * @see mozSpellChecker::GetPersonalDictionary
    * @see GetPersonalDictionaryWord
    */
   void          GetPersonalDictionary();
 
   /**
    * Used after you call GetPersonalDictionary() to iterate through all the
    * words added to the personal dictionary. Will return the empty string when
    * there are no more words.
    */
   AString       GetPersonalDictionaryWord();
 
   /**
    * Adds a word to the current personal dictionary.
    *
-   * @see nsISpellChecker::AddWordToDictionary
+   * @see mozSpellChecker::AddWordToDictionary
    */
   void          AddWordToDictionary(in AString word);
 
   /**
    * Removes a word from the current personal dictionary.
    *
-   * @see nsISpellChecker::RemoveWordFromPersonalDictionary
+   * @see mozSpellChecker::RemoveWordFromPersonalDictionary
    */
   void          RemoveWordFromDictionary(in AString word);
 
   /**
    * Retrieves a list of the currently available dictionaries. The strings will
    * typically be language IDs, like "en-US".
    *
    * @see mozISpellCheckingEngine::GetDictionaryList
    */
   void          GetDictionaryList([array, size_is(count)] out wstring dictionaryList, out uint32_t count);
 
   /**
-   * @see nsISpellChecker::GetCurrentDictionary
+   * @see mozSpellChecker::GetCurrentDictionary
    */
   AString       GetCurrentDictionary();
 
   /**
-   * @see nsISpellChecker::SetCurrentDictionary
+   * @see mozSpellChecker::SetCurrentDictionary
    */
   void          SetCurrentDictionary(in AString dictionary);
 
   /**
    * Call this to free up the spell checking object. It will also save the
    * current selected language as the default for future use.
    *
    * If you have called CanSpellCheck but not InitSpellChecker, you can still
--- a/editor/spellchecker/moz.build
+++ b/editor/spellchecker/moz.build
@@ -7,20 +7,16 @@
 MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
 
 XPIDL_SOURCES += [
     'nsIInlineSpellChecker.idl',
 ]
 
 XPIDL_MODULE = 'txtsvc'
 
-EXPORTS += [
-    'nsISpellChecker.h',
-]
-
 EXPORTS.mozilla += [
     'EditorSpellCheck.h',
     'TextServicesDocument.h',
 ]
 
 UNIFIED_SOURCES += [
     'EditorSpellCheck.cpp',
     'nsComposeTxtSrvFilter.cpp',
deleted file mode 100644
--- a/editor/spellchecker/nsISpellChecker.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsISpellChecker_h__
-#define nsISpellChecker_h__
-
-#include "mozilla/MozPromise.h"
-#include "nsISupports.h"
-#include "nsStringFwd.h"
-#include "nsTArray.h"
-
-#define NS_ISPELLCHECKER_IID                    \
-{ /* 27bff957-b486-40ae-9f5d-af0cdd211868 */    \
-0x27bff957, 0xb486, 0x40ae, \
-  { 0x9f, 0x5d, 0xaf, 0x0c, 0xdd, 0x21, 0x18, 0x68 } }
-
-namespace mozilla {
-class TextServicesDocument;
-} // namespace mozilla
-
-/**
- * A generic interface for a spelling checker.
- */
-class nsISpellChecker  : public nsISupports{
-public:
-
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISPELLCHECKER_IID)
-
-  /**
-   * Tells the spellchecker what document to check.
-   * @param aDoc is the document to check.
-   * @param aFromStartOfDoc If true, start check from beginning of document,
-   * if false, start check from current cursor position.
-   */
-  NS_IMETHOD SetDocument(mozilla::TextServicesDocument* aDoc,
-                         bool aFromStartofDoc) = 0;
-
-  /**
-   * Selects (hilites) the next misspelled word in the document.
-   * @param aWord will contain the misspelled word.
-   * @param aSuggestions is an array of nsStrings, that represent the
-   * suggested replacements for the misspelled word.
-   */
-  NS_IMETHOD NextMisspelledWord(nsAString &aWord, nsTArray<nsString> *aSuggestions) = 0;
-
-  /**
-   * Checks if a word is misspelled. No document is required to use this method.
-   * @param aWord is the word to check.
-   * @param aIsMisspelled will be set to true if the word is misspelled.
-   * @param aSuggestions is an array of nsStrings which represent the
-   * suggested replacements for the misspelled word. The array will be empty
-   * if there aren't any suggestions.
-   */
-  NS_IMETHOD CheckWord(const nsAString &aWord, bool *aIsMisspelled, nsTArray<nsString> *aSuggestions) = 0;
-
-  /**
-   * Replaces the old word with the specified new word.
-   * @param aOldWord is the word to be replaced.
-   * @param aNewWord is the word that is to replace old word.
-   * @param aAllOccurrences will replace all occurrences of old
-   * word, in the document, with new word when it is true. If
-   * false, it will replace the 1st occurrence only!
-   */
-  NS_IMETHOD Replace(const nsAString &aOldWord, const nsAString &aNewWord, bool aAllOccurrences) = 0;
-
-  /**
-   * Ignores all occurrences of the specified word in the document.
-   * @param aWord is the word to ignore.
-   */
-  NS_IMETHOD IgnoreAll(const nsAString &aWord) = 0;
-
-  /**
-   * Add a word to the user's personal dictionary.
-   * @param aWord is the word to add.
-   */
-  NS_IMETHOD AddWordToPersonalDictionary(const nsAString &aWord) = 0;
-
-  /**
-   * Remove a word from the user's personal dictionary.
-   * @param aWord is the word to remove.
-   */
-  NS_IMETHOD RemoveWordFromPersonalDictionary(const nsAString &aWord) = 0;
-
-  /**
-   * Returns the list of words in the user's personal dictionary.
-   * @param aWordList is an array of nsStrings that represent the
-   * list of words in the user's personal dictionary.
-   */
-  NS_IMETHOD GetPersonalDictionary(nsTArray<nsString> *aWordList) = 0;
-
-  /**
-   * Returns the list of strings representing the dictionaries
-   * the spellchecker supports. It was suggested that the strings
-   * returned be in the RFC 1766 format. This format looks something
-   * like <ISO 639 language code>-<ISO 3166 country code>.
-   * For example: en-US
-   * @param aDictionaryList is an array of nsStrings that represent the
-   * dictionaries supported by the spellchecker.
-   */
-  NS_IMETHOD GetDictionaryList(nsTArray<nsString> *aDictionaryList) = 0;
-
-  /**
-   * Returns a string representing the current dictionary.
-   * @param aDictionary will contain the name of the dictionary.
-   * This name is the same string that is in the list returned
-   * by GetDictionaryList().
-   */
-  NS_IMETHOD GetCurrentDictionary(nsAString &aDictionary) = 0;
-
-  /**
-   * Tells the spellchecker to use a specific dictionary.
-   * @param aDictionary a string that is in the list returned
-   * by GetDictionaryList() or an empty string. If aDictionary is
-   * empty string, spellchecker will be disabled.
-   */
-  NS_IMETHOD SetCurrentDictionary(const nsAString &aDictionary) = 0;
-
-  /**
-   * Tells the spellchecker to use a specific dictionary from list.
-   * @param aList  a preferred dictionary list
-   */
-  NS_IMETHOD_(RefPtr<mozilla::GenericPromise>)
-    SetCurrentDictionaryFromList(const nsTArray<nsString>& aList) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsISpellChecker, NS_ISPELLCHECKER_IID)
-
-#endif // nsISpellChecker_h__
-
--- a/extensions/spellcheck/src/mozSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozSpellChecker.cpp
@@ -19,29 +19,23 @@
 using mozilla::dom::ContentChild;
 using mozilla::GenericPromise;
 using mozilla::PRemoteSpellcheckEngineChild;
 using mozilla::RemoteSpellcheckEngineChild;
 using mozilla::TextServicesDocument;
 
 #define DEFAULT_SPELL_CHECKER "@mozilla.org/spellchecker/engine;1"
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(mozSpellChecker)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(mozSpellChecker)
-
-NS_INTERFACE_MAP_BEGIN(mozSpellChecker)
-  NS_INTERFACE_MAP_ENTRY(nsISpellChecker)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISpellChecker)
-  NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(mozSpellChecker)
-NS_INTERFACE_MAP_END
-
 NS_IMPL_CYCLE_COLLECTION(mozSpellChecker,
                          mTextServicesDocument,
                          mPersonalDictionary)
 
+NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(mozSpellChecker, AddRef)
+NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(mozSpellChecker, Release)
+
 mozSpellChecker::mozSpellChecker()
   : mEngine(nullptr)
 {
 }
 
 mozSpellChecker::~mozSpellChecker()
 {
   if (mPersonalDictionary) {
@@ -75,27 +69,27 @@ mozSpellChecker::Init()
 }
 
 TextServicesDocument*
 mozSpellChecker::GetTextServicesDocument()
 {
   return mTextServicesDocument;
 }
 
-NS_IMETHODIMP
+nsresult
 mozSpellChecker::SetDocument(TextServicesDocument* aTextServicesDocument,
                              bool aFromStartofDoc)
 {
   mTextServicesDocument = aTextServicesDocument;
   mFromStart = aFromStartofDoc;
   return NS_OK;
 }
 
 
-NS_IMETHODIMP
+nsresult
 mozSpellChecker::NextMisspelledWord(nsAString &aWord, nsTArray<nsString> *aSuggestions)
 {
   if(!aSuggestions||!mConverter)
     return NS_ERROR_NULL_POINTER;
 
   int32_t selOffset;
   int32_t begin,end;
   nsresult result;
@@ -130,17 +124,17 @@ mozSpellChecker::NextMisspelledWord(nsAS
       selOffset = end;
     } while(end != -1);
     mTextServicesDocument->NextBlock();
     selOffset=0;
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 mozSpellChecker::CheckWord(const nsAString &aWord, bool *aIsMisspelled, nsTArray<nsString> *aSuggestions)
 {
   nsresult result;
   bool correct;
 
   if (XRE_IsContentProcess()) {
     nsString wordwrapped = nsString(aWord);
     bool rv;
@@ -173,17 +167,17 @@ mozSpellChecker::CheckWord(const nsAStri
       if (count)
         NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(count, words);
     }
     *aIsMisspelled = true;
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 mozSpellChecker::Replace(const nsAString &aOldWord, const nsAString &aNewWord, bool aAllOccurrences)
 {
   if(!mConverter)
     return NS_ERROR_NULL_POINTER;
 
   nsAutoString newWord(aNewWord); // sigh
 
   if(aAllOccurrences){
@@ -264,48 +258,48 @@ mozSpellChecker::Replace(const nsAString
       }
     }
   } else {
     mTextServicesDocument->InsertText(&newWord);
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 mozSpellChecker::IgnoreAll(const nsAString &aWord)
 {
   if (mPersonalDictionary) {
     mPersonalDictionary->IgnoreWord(aWord);
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 mozSpellChecker::AddWordToPersonalDictionary(const nsAString &aWord)
 {
   nsresult res;
   if (NS_WARN_IF(!mPersonalDictionary)) {
     return NS_ERROR_NOT_INITIALIZED;
   }
   res = mPersonalDictionary->AddWord(aWord);
   return res;
 }
 
-NS_IMETHODIMP
+nsresult
 mozSpellChecker::RemoveWordFromPersonalDictionary(const nsAString &aWord)
 {
   nsresult res;
   if (NS_WARN_IF(!mPersonalDictionary)) {
     return NS_ERROR_NOT_INITIALIZED;
   }
   res = mPersonalDictionary->RemoveWord(aWord);
   return res;
 }
 
-NS_IMETHODIMP
+nsresult
 mozSpellChecker::GetPersonalDictionary(nsTArray<nsString> *aWordList)
 {
   if(!aWordList || !mPersonalDictionary)
     return NS_ERROR_NULL_POINTER;
 
   nsCOMPtr<nsIStringEnumerator> words;
   mPersonalDictionary->GetWordList(getter_AddRefs(words));
 
@@ -313,17 +307,17 @@ mozSpellChecker::GetPersonalDictionary(n
   nsAutoString word;
   while (NS_SUCCEEDED(words->HasMore(&hasMore)) && hasMore) {
     words->GetNext(word);
     aWordList->AppendElement(word);
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 mozSpellChecker::GetDictionaryList(nsTArray<nsString> *aDictionaryList)
 {
   if (XRE_IsContentProcess()) {
     ContentChild *child = ContentChild::GetSingleton();
     child->GetAvailableDictionaries(*aDictionaryList);
     return NS_OK;
   }
 
@@ -361,33 +355,33 @@ mozSpellChecker::GetDictionaryList(nsTAr
     }
 
     NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(count, words);
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 mozSpellChecker::GetCurrentDictionary(nsAString &aDictionary)
 {
   if (XRE_IsContentProcess()) {
     aDictionary = mCurrentDictionary;
     return NS_OK;
   }
 
   if (!mSpellCheckingEngine) {
     aDictionary.Truncate();
     return NS_OK;
   }
 
   return mSpellCheckingEngine->GetDictionary(aDictionary);
 }
 
-NS_IMETHODIMP
+nsresult
 mozSpellChecker::SetCurrentDictionary(const nsAString &aDictionary)
 {
   if (XRE_IsContentProcess()) {
     nsString wrappedDict = nsString(aDictionary);
     bool isSuccess;
     mEngine->SendSetDictionary(wrappedDict, &isSuccess);
     if (!isSuccess) {
       mCurrentDictionary.Truncate();
@@ -430,17 +424,17 @@ mozSpellChecker::SetCurrentDictionary(co
   }
 
   mSpellCheckingEngine = nullptr;
 
   // We could not find any engine with the requested dictionary
   return NS_ERROR_NOT_AVAILABLE;
 }
 
-NS_IMETHODIMP_(RefPtr<GenericPromise>)
+RefPtr<GenericPromise>
 mozSpellChecker::SetCurrentDictionaryFromList(const nsTArray<nsString>& aList)
 {
   if (aList.IsEmpty()) {
     return GenericPromise::CreateAndReject(NS_ERROR_INVALID_ARG, __func__);
   }
 
   if (XRE_IsContentProcess()) {
     // mCurrentDictionary will be set by RemoteSpellCheckEngineChild
--- a/extensions/spellcheck/src/mozSpellChecker.h
+++ b/extensions/spellcheck/src/mozSpellChecker.h
@@ -3,62 +3,143 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozSpellChecker_h__
 #define mozSpellChecker_h__
 
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
-#include "nsISpellChecker.h"
 #include "nsString.h"
 #include "mozIPersonalDictionary.h"
 #include "mozISpellCheckingEngine.h"
 #include "nsClassHashtable.h"
 #include "nsTArray.h"
 #include "nsCycleCollectionParticipant.h"
 
 class mozEnglishWordUtils;
 
 namespace mozilla {
 class RemoteSpellcheckEngineChild;
+class TextServicesDocument;
 } // namespace mozilla
 
-class mozSpellChecker final : public nsISpellChecker
+class mozSpellChecker final
 {
 public:
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_CLASS(mozSpellChecker)
+  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(mozSpellChecker)
+  NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(mozSpellChecker)
 
   static already_AddRefed<mozSpellChecker>
   Create()
   {
     RefPtr<mozSpellChecker> spellChecker = new mozSpellChecker();
     nsresult rv = spellChecker->Init();
     NS_ENSURE_SUCCESS(rv, nullptr);
     return spellChecker.forget();
   }
 
-  // nsISpellChecker
-  NS_IMETHOD SetDocument(mozilla::TextServicesDocument* aTextServicesDocument,
-                         bool aFromStartofDoc) override;
-  NS_IMETHOD NextMisspelledWord(nsAString &aWord, nsTArray<nsString> *aSuggestions) override;
-  NS_IMETHOD CheckWord(const nsAString &aWord, bool *aIsMisspelled, nsTArray<nsString> *aSuggestions) override;
-  NS_IMETHOD Replace(const nsAString &aOldWord, const nsAString &aNewWord, bool aAllOccurrences) override;
-  NS_IMETHOD IgnoreAll(const nsAString &aWord) override;
+  /**
+   * Tells the spellchecker what document to check.
+   * @param aDoc is the document to check.
+   * @param aFromStartOfDoc If true, start check from beginning of document,
+   * if false, start check from current cursor position.
+   */
+  nsresult SetDocument(mozilla::TextServicesDocument* aTextServicesDocument,
+                       bool aFromStartofDoc);
+
+  /**
+   * Selects (hilites) the next misspelled word in the document.
+   * @param aWord will contain the misspelled word.
+   * @param aSuggestions is an array of nsStrings, that represent the
+   * suggested replacements for the misspelled word.
+   */
+  nsresult NextMisspelledWord(nsAString& aWord,
+                              nsTArray<nsString>* aSuggestions);
+
+  /**
+   * Checks if a word is misspelled. No document is required to use this method.
+   * @param aWord is the word to check.
+   * @param aIsMisspelled will be set to true if the word is misspelled.
+   * @param aSuggestions is an array of nsStrings which represent the
+   * suggested replacements for the misspelled word. The array will be empty
+   * if there aren't any suggestions.
+   */
+  nsresult CheckWord(const nsAString& aWord, bool* aIsMisspelled,
+                     nsTArray<nsString>* aSuggestions);
+
+  /**
+   * Replaces the old word with the specified new word.
+   * @param aOldWord is the word to be replaced.
+   * @param aNewWord is the word that is to replace old word.
+   * @param aAllOccurrences will replace all occurrences of old
+   * word, in the document, with new word when it is true. If
+   * false, it will replace the 1st occurrence only!
+   */
+  nsresult Replace(const nsAString& aOldWord, const nsAString& aNewWord,
+                   bool aAllOccurrences);
+
+  /**
+   * Ignores all occurrences of the specified word in the document.
+   * @param aWord is the word to ignore.
+   */
+  nsresult IgnoreAll(const nsAString& aWord);
 
-  NS_IMETHOD AddWordToPersonalDictionary(const nsAString &aWord) override;
-  NS_IMETHOD RemoveWordFromPersonalDictionary(const nsAString &aWord) override;
-  NS_IMETHOD GetPersonalDictionary(nsTArray<nsString> *aWordList) override;
+  /**
+   * Add a word to the user's personal dictionary.
+   * @param aWord is the word to add.
+   */
+  nsresult AddWordToPersonalDictionary(const nsAString& aWord);
+
+  /**
+   * Remove a word from the user's personal dictionary.
+   * @param aWord is the word to remove.
+   */
+  nsresult RemoveWordFromPersonalDictionary(const nsAString& aWord);
+
+  /**
+   * Returns the list of words in the user's personal dictionary.
+   * @param aWordList is an array of nsStrings that represent the
+   * list of words in the user's personal dictionary.
+   */
+  nsresult GetPersonalDictionary(nsTArray<nsString>* aWordList);
 
-  NS_IMETHOD GetDictionaryList(nsTArray<nsString> *aDictionaryList) override;
-  NS_IMETHOD GetCurrentDictionary(nsAString &aDictionary) override;
-  NS_IMETHOD SetCurrentDictionary(const nsAString &aDictionary) override;
-  NS_IMETHOD_(RefPtr<mozilla::GenericPromise>)
-    SetCurrentDictionaryFromList(const nsTArray<nsString>& aList) override;
+  /**
+   * Returns the list of strings representing the dictionaries
+   * the spellchecker supports. It was suggested that the strings
+   * returned be in the RFC 1766 format. This format looks something
+   * like <ISO 639 language code>-<ISO 3166 country code>.
+   * For example: en-US
+   * @param aDictionaryList is an array of nsStrings that represent the
+   * dictionaries supported by the spellchecker.
+   */
+  nsresult GetDictionaryList(nsTArray<nsString>* aDictionaryList);
+
+  /**
+   * Returns a string representing the current dictionary.
+   * @param aDictionary will contain the name of the dictionary.
+   * This name is the same string that is in the list returned
+   * by GetDictionaryList().
+   */
+  nsresult GetCurrentDictionary(nsAString& aDictionary);
+
+  /**
+   * Tells the spellchecker to use a specific dictionary.
+   * @param aDictionary a string that is in the list returned
+   * by GetDictionaryList() or an empty string. If aDictionary is
+   * empty string, spellchecker will be disabled.
+   */
+  nsresult SetCurrentDictionary(const nsAString& aDictionary);
+
+  /**
+   * Tells the spellchecker to use a specific dictionary from list.
+   * @param aList  a preferred dictionary list
+   */
+  RefPtr<mozilla::GenericPromise>
+  SetCurrentDictionaryFromList(const nsTArray<nsString>& aList);
 
   void DeleteRemoteEngine() {
     mEngine = nullptr;
   }
 
   mozilla::TextServicesDocument* GetTextServicesDocument();
 
 protected: