Bug 1692971 [wpt PR 27638] - WebKit export of https://bugs.webkit.org/show_bug.cgi...
[gecko.git] / toolkit / actors / InlineSpellCheckerParent.jsm
blob84b8a616cc4397522531ff9216e1d0808c6d38ed
1 /* -*- mode: js; indent-tabs-mode: nil; js-indent-level: 2 -*- */
2 /* vim: set ts=2 sw=2 sts=2 et tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 "use strict";
9 var EXPORTED_SYMBOLS = ["InlineSpellCheckerParent"];
11 class InlineSpellCheckerParent extends JSWindowActorParent {
12   selectDictionary({ localeCode }) {
13     this.sendAsyncMessage("InlineSpellChecker:selectDictionary", {
14       localeCode,
15     });
16   }
18   replaceMisspelling({ index }) {
19     this.sendAsyncMessage("InlineSpellChecker:replaceMisspelling", { index });
20   }
22   toggleEnabled() {
23     this.sendAsyncMessage("InlineSpellChecker:toggleEnabled", {});
24   }
26   recheckSpelling() {
27     this.sendAsyncMessage("InlineSpellChecker:recheck", {});
28   }
30   uninit() {
31     // This method gets called by InlineSpellChecker when the context menu
32     // goes away and the InlineSpellChecker instance is still alive.
33     // Stop referencing it and tidy the child end of us.
34     this.sendAsyncMessage("InlineSpellChecker:uninit", {});
35   }
37   _destructionObservers = new Set();
38   registerDestructionObserver(obj) {
39     this._destructionObservers.add(obj);
40   }
42   unregisterDestructionObserver(obj) {
43     this._destructionObservers.delete(obj);
44   }
46   didDestroy() {
47     for (let obs of this._destructionObservers) {
48       obs.actorDestroyed(this);
49     }
50     this._destructionObservers = null;
51   }