diff --git a/extensions/spellcheck/hunspell/glue/RemoteSpellCheckEngineChild.cpp b/extensions/spellcheck/hunspell/glue/RemoteSpellCheckEngineChild.cpp index dc2ee73926d2e..ae9a38ce12aed 100644 --- a/extensions/spellcheck/hunspell/glue/RemoteSpellCheckEngineChild.cpp +++ b/extensions/spellcheck/hunspell/glue/RemoteSpellCheckEngineChild.cpp @@ -40,4 +40,20 @@ RemoteSpellcheckEngineChild::SetCurrentDictionaryFromList( }); } +RefPtr RemoteSpellcheckEngineChild::CheckWords( + const nsTArray& aWords) { + RefPtr kungFuDeathGrip = mOwner; + + return SendCheckAsync(aWords)->Then( + GetMainThreadSerialEventTarget(), __func__, + [kungFuDeathGrip](nsTArray&& aIsMisspelled) { + return CheckWordPromise::CreateAndResolve(std::move(aIsMisspelled), + __func__); + }, + [kungFuDeathGrip](mozilla::ipc::ResponseRejectReason&& aReason) { + return CheckWordPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE, + __func__); + }); +} + } // namespace mozilla diff --git a/extensions/spellcheck/hunspell/glue/RemoteSpellCheckEngineChild.h b/extensions/spellcheck/hunspell/glue/RemoteSpellCheckEngineChild.h index 766976e136b9e..003488bb13dbd 100644 --- a/extensions/spellcheck/hunspell/glue/RemoteSpellCheckEngineChild.h +++ b/extensions/spellcheck/hunspell/glue/RemoteSpellCheckEngineChild.h @@ -22,6 +22,8 @@ class RemoteSpellcheckEngineChild RefPtr SetCurrentDictionaryFromList( const nsTArray& aList); + RefPtr CheckWords(const nsTArray& aWords); + private: mozSpellChecker* mOwner; }; diff --git a/extensions/spellcheck/src/mozSpellChecker.cpp b/extensions/spellcheck/src/mozSpellChecker.cpp index cfcd726192073..35d1737a341c4 100644 --- a/extensions/spellcheck/src/mozSpellChecker.cpp +++ b/extensions/spellcheck/src/mozSpellChecker.cpp @@ -117,16 +117,7 @@ nsresult mozSpellChecker::NextMisspelledWord(nsAString& aWord, RefPtr mozSpellChecker::CheckWords( const nsTArray& aWords) { if (XRE_IsContentProcess()) { - return mEngine->SendCheckAsync(aWords)->Then( - GetMainThreadSerialEventTarget(), __func__, - [](nsTArray&& aIsMisspelled) { - return CheckWordPromise::CreateAndResolve(std::move(aIsMisspelled), - __func__); - }, - [](mozilla::ipc::ResponseRejectReason&& aReason) { - return CheckWordPromise::CreateAndReject(NS_ERROR_NOT_AVAILABLE, - __func__); - }); + return mEngine->CheckWords(aWords); } nsTArray misspells;