mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1489793 - Part 1: Remove the XPCOM component registration for EditorSpellCheck; r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D5371
This commit is contained in:
parent
dd4888c82d
commit
d536808f38
@ -3,7 +3,6 @@
|
||||
* 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/. */
|
||||
|
||||
#include "mozilla/EditorSpellCheck.h" // for NS_EDITORSPELLCHECK_CID, etc
|
||||
#include "mozilla/HTMLEditorController.h" // for HTMLEditorController, etc
|
||||
#include "mozilla/Module.h" // for Module, Module::CIDEntry, etc
|
||||
#include "mozilla/ModuleUtils.h"
|
||||
@ -22,8 +21,6 @@
|
||||
#include "nsServiceManagerUtils.h" // for do_GetService
|
||||
#include "nscore.h" // for nsresult
|
||||
|
||||
using mozilla::EditorSpellCheck;
|
||||
|
||||
class nsISupports;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@ -32,17 +29,11 @@ class nsISupports;
|
||||
// NOTE: This creates an instance of objects by using the default constructor
|
||||
//
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(EditorSpellCheck)
|
||||
|
||||
NS_DEFINE_NAMED_CID(NS_EDITORSPELLCHECK_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kComposerCIDs[] = {
|
||||
{ &kNS_EDITORSPELLCHECK_CID, false, nullptr, EditorSpellCheckConstructor },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kComposerContracts[] = {
|
||||
{ "@mozilla.org/editor/editorspellchecker;1", &kNS_EDITORSPELLCHECK_CID },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
|
@ -21,9 +21,7 @@ SimpleTest.waitForFocus(() => {
|
||||
let textarea = document.getElementById("textarea");
|
||||
let editor = SpecialPowers.wrap(textarea).editor;
|
||||
|
||||
let spellChecker =
|
||||
SpecialPowers.Cc['@mozilla.org/editor/editorspellchecker;1']
|
||||
.createInstance(SpecialPowers.Ci.nsIEditorSpellCheck);
|
||||
let spellChecker = SpecialPowers.Cu.createSpellChecker();
|
||||
spellChecker.InitSpellChecker(editor, false);
|
||||
|
||||
textarea.focus();
|
||||
|
@ -19,12 +19,6 @@ class mozSpellChecker;
|
||||
class nsIEditor;
|
||||
class nsISpellChecker;
|
||||
|
||||
#define NS_EDITORSPELLCHECK_CID \
|
||||
{ /* {75656ad9-bd13-4c5d-939a-ec6351eea0cc} */ \
|
||||
0x75656ad9, 0xbd13, 0x4c5d, \
|
||||
{ 0x93, 0x9a, 0xec, 0x63, 0x51, 0xee, 0xa0, 0xcc }\
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class DictionaryFetcher;
|
||||
|
@ -44,8 +44,7 @@ SimpleTest.waitForFocus(function() {
|
||||
|
||||
is(sel.toString(), "missspelled", "one misspelled word expected: missspelled");
|
||||
|
||||
spellchecker = SpecialPowers.Cc['@mozilla.org/editor/editorspellchecker;1']
|
||||
.createInstance(Ci.nsIEditorSpellCheck);
|
||||
let spellChecker = SpecialPowers.Cu.createSpellChecker();
|
||||
spellchecker.setFilterType(spellchecker.FILTERTYPE_NORMAL);
|
||||
spellchecker.InitSpellChecker(editor, false, spellCheckStarted);
|
||||
});
|
||||
|
@ -21,9 +21,7 @@ SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(() => {
|
||||
let textarea = document.getElementById("editor");
|
||||
let editor = SpecialPowers.wrap(textarea).editor;
|
||||
let spellChecker =
|
||||
SpecialPowers.Cc['@mozilla.org/editor/editorspellchecker;1']
|
||||
.createInstance(SpecialPowers.Ci.nsIEditorSpellCheck);
|
||||
let spellChecker = SpecialPowers.Cu.createSpellChecker();
|
||||
|
||||
// Callback parameter isn't set
|
||||
spellChecker.InitSpellChecker(editor, false);
|
||||
|
@ -667,16 +667,13 @@ nsresult mozInlineSpellChecker::Cleanup(bool aDestroyingFrames)
|
||||
bool // static
|
||||
mozInlineSpellChecker::CanEnableInlineSpellChecking()
|
||||
{
|
||||
nsresult rv;
|
||||
if (gCanEnableSpellChecking == SpellCheck_Uninitialized) {
|
||||
gCanEnableSpellChecking = SpellCheck_NotAvailable;
|
||||
|
||||
nsCOMPtr<nsIEditorSpellCheck> spellchecker =
|
||||
do_CreateInstance("@mozilla.org/editor/editorspellchecker;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
nsCOMPtr<nsIEditorSpellCheck> spellchecker = new EditorSpellCheck();
|
||||
|
||||
bool canSpellCheck = false;
|
||||
rv = spellchecker->CanSpellCheck(&canSpellCheck);
|
||||
nsresult rv = spellchecker->CanSpellCheck(&canSpellCheck);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
if (canSpellCheck)
|
||||
|
@ -13,6 +13,7 @@ interface xpcIJSWeakReference;
|
||||
interface nsIClassInfo;
|
||||
interface nsIComponentManager;
|
||||
interface nsICycleCollectorListener;
|
||||
interface nsIEditorSpellCheck;
|
||||
interface nsIFile;
|
||||
interface nsIURI;
|
||||
interface nsIJSCID;
|
||||
@ -716,6 +717,9 @@ interface nsIXPCComponents_Utils : nsISupports
|
||||
|
||||
/* Give a directive to the record/replay system. */
|
||||
void recordReplayDirective(in long directive);
|
||||
|
||||
/* Create a spellchecker object. */
|
||||
nsIEditorSpellCheck createSpellChecker();
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsScriptError.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "mozilla/EditorSpellCheck.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace JS;
|
||||
@ -3117,6 +3118,16 @@ nsXPCComponents_Utils::RecordReplayDirective(int aDirective)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXPCComponents_Utils::CreateSpellChecker(nsIEditorSpellCheck** aSpellChecker)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSpellChecker);
|
||||
nsCOMPtr<nsIEditorSpellCheck> spellChecker =
|
||||
new mozilla::EditorSpellCheck();
|
||||
spellChecker.forget(aSpellChecker);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
/***************************************************************************/
|
||||
/***************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user