Bug 1843794 - Rewrite editor/AsyncSpellCheckTestHelper.sys.mjs consumers in html/xhtml to use ChromeUtils.importESModule. r=masayuki

Depends on D183689

Differential Revision: https://phabricator.services.mozilla.com/D183690
This commit is contained in:
Tooru Fujisawa 2023-07-19 00:43:33 +00:00
parent d32481d262
commit d984b79117
44 changed files with 88 additions and 88 deletions

View File

@ -7,8 +7,8 @@ function load()
let textarea = document.getElementById("editor");
textarea.focus();
const { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://reftest/AsyncSpellCheckTestHelper.jsm"
const { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://reftest/AsyncSpellCheckTestHelper.sys.mjs"
);
maybeOnSpellCheck(textarea, () => {
let isc = SpecialPowers.wrap(textarea).editor.getInlineSpellChecker(false);

View File

@ -72,8 +72,8 @@ SimpleTest.waitForFocus(async () => {
let inlineSpellchecker = SpecialPowers.wrap(textarea).editor.getInlineSpellChecker(true);
textarea.value = "abx ";
await new Promise(resolve => {
const { onSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
const { onSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
onSpellCheck(textarea, () => {
SimpleTest.executeSoon(resolve);

View File

@ -93,8 +93,8 @@ SimpleTest.waitForFocus(async () => {
return aElement === textarea ? aElement.value : aElement.innerHTML;
}
const { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
const { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
maybeOnSpellCheck(aElement, () => {
SimpleTest.executeSoon(() => {

View File

@ -24,8 +24,8 @@ function start() {
var textarea = document.getElementById("editor");
textarea.focus();
const { onSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
const { onSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
)
onSpellCheck(textarea, function() {
var isc = SpecialPowers.wrap(textarea).editor.getInlineSpellChecker(false);

View File

@ -23,8 +23,8 @@ fivee sixx<br>
<script class="testbody" type="application/javascript">
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
/** Test for Bug 1100966 **/

View File

@ -22,8 +22,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1154791
<script class="testbody" type="application/javascript">
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
/** Test for Bug 1154791 **/

View File

@ -106,8 +106,8 @@ function continueTest(evt) {
var inlineSpellChecker = editor.getInlineSpellChecker(true);
const is_en_US = SpecialPowers.Services.locale.appLocaleAsBCP47 == "en-US";
const { onSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
const { onSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
onSpellCheck(elem, async function() {
var spellchecker = inlineSpellChecker.spellChecker;

View File

@ -69,8 +69,8 @@ var loadListener = async function(evt) {
editor.setSpellcheckUserOverride(true);
var inlineSpellChecker = editor.getInlineSpellChecker(true);
const { onSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
const { onSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
onSpellCheck(elem, async function() {
let spellchecker = inlineSpellChecker.spellChecker;

View File

@ -28,8 +28,8 @@ var editor_de;
var selcon_de;
var script;
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
/** Test for Bug 1205983 **/

View File

@ -36,8 +36,8 @@ var script;
* user behaviour.
*/
let { maybeOnSpellCheck, onSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
let { maybeOnSpellCheck, onSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
SimpleTest.waitForExplicitFinish();

View File

@ -29,8 +29,8 @@ var spellchecker;
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
var elem = document.getElementById("en-US");

View File

@ -29,8 +29,8 @@ SimpleTest.waitForFocus(() => {
textarea.focus();
const { onSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
const { onSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
onSpellCheck(textarea, () => {
// Callback parameter isn't set

View File

@ -30,8 +30,8 @@ SimpleTest.waitForFocus(() => {
textarea.focus();
const { onSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
const { onSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
onSpellCheck(textarea, () => {
spellChecker.UpdateCurrentDictionary(() => {

View File

@ -21,8 +21,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1402822
const Ci = SpecialPowers.Ci;
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
function getMisspelledWords(editor) {

View File

@ -19,8 +19,8 @@
<div id="edit1" contenteditable=true></div>
<script>
const { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
const { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
SimpleTest.waitForExplicitFinish();

View File

@ -23,8 +23,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1497480
/** Test for Bug 1497480 **/
let gMisspeltWords = [];
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
const template = document.createElement("template");

View File

@ -17,8 +17,8 @@
<div id="contenteditable" contenteditable=true>kkkk&#xf6;kkkk</div>
<script>
const { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
const { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
SimpleTest.waitForExplicitFinish();

View File

@ -24,8 +24,8 @@ const Ci = SpecialPowers.Ci;
let {
getDictionaryContentPref,
onSpellCheck,
} = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
} = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
/** Test for Bug 1402822 **/

View File

@ -22,8 +22,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1773802
const Ci = SpecialPowers.Ci;
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
function getMisspelledWords(editor) {

View File

@ -20,8 +20,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338427
/** Test for Bug 338427 **/
function init() {
var { onSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
var { onSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
var textarea = document.getElementById("editor");
var editor = SpecialPowers.wrap(textarea).editor;

View File

@ -45,8 +45,8 @@ function runTest() {
editDoc().designMode = "on";
editDoc().defaultView.focus();
const { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
const { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
maybeOnSpellCheck(editDoc().documentElement, evalTest);
}

View File

@ -21,8 +21,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=432225
/** Test for Bug 432225 **/
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
SimpleTest.waitForExplicitFinish();

View File

@ -46,8 +46,8 @@ function runTest() {
var edit = document.getElementById("edit");
edit.focus();
const { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
const { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
maybeOnSpellCheck(edit, function() {
ok(isSpellingCheckOk(getEditor(), gMisspeltWords),

View File

@ -121,8 +121,8 @@ function runTest() {
var edit = document.getElementById("edit");
edit.focus();
onSpellCheck = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
onSpellCheck = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
).onSpellCheck;
onSpellCheck(edit, runOnFocus);
}

View File

@ -11,8 +11,8 @@
SimpleTest.waitForExplicitFinish();
function runTest() {
const { onSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
const { onSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
var x = document.getElementById("x");
x.focus();

View File

@ -62,8 +62,8 @@ var loadListener = async function(evt) {
editor.setSpellcheckUserOverride(true);
var inlineSpellChecker = editor.getInlineSpellChecker(true);
const { onSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
const { onSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
onSpellCheck(elem, async function() {
let spellchecker = inlineSpellChecker.spellChecker;

View File

@ -27,8 +27,8 @@ var elem_de;
var editor_de;
var script;
var { maybeOnSpellCheck, onSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
var { maybeOnSpellCheck, onSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
/** Test for Bug 697981 **/

View File

@ -63,8 +63,8 @@ var loadListener = async function(evt) {
editor.setSpellcheckUserOverride(true);
var inlineSpellChecker = editor.getInlineSpellChecker(true);
const { onSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
const { onSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
onSpellCheck(elem, async function() {
let spellchecker = inlineSpellChecker.spellChecker;

View File

@ -106,8 +106,8 @@ function continueTest(evt) {
var inlineSpellChecker = editor.getInlineSpellChecker(true);
const is_en_US = SpecialPowers.Services.locale.appLocaleAsBCP47 == "en-US";
const { onSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
const { onSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
onSpellCheck(elem, async function() {
var spellchecker = inlineSpellChecker.spellChecker;

View File

@ -12,8 +12,8 @@
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(async () => {
const { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
const { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
const editor = document.querySelector("div[contenteditable]");
async function replaceWord(aMisspelledWord, aCorrectWord, aReplaceAll) {

View File

@ -8,8 +8,8 @@
</head>
<body>
<script>
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
function waitForTick() {

View File

@ -13,8 +13,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1729653
<body>
<textarea rows="20" cols="50">That undfgdfg seems OK.</textarea>
<script>
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
function waitForTick() {

View File

@ -10,8 +10,8 @@
add_task(async function() {
await new Promise(resolve => SimpleTest.waitForFocus(resolve));
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
let editingHost = document.querySelector("div[contenteditable][lang=en-US]");

View File

@ -15,8 +15,8 @@
add_task(async function() {
await new Promise(resolve => SimpleTest.waitForFocus(resolve));
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
let element = document.getElementById("en-US");

View File

@ -65,8 +65,8 @@ function RunTest() {
ok(map.exists());
hunspell.addDirectory(map);
const {maybeOnSpellCheck} = ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm");
const {maybeOnSpellCheck} = ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs");
maybeOnSpellCheck(textbox, function () {
// test that base and map dictionaries are available

View File

@ -14,8 +14,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1170484
/** Test for Bug 1170484 */
SimpleTest.waitForExplicitFinish();
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
SimpleTest.waitForFocus(doTest, window);

View File

@ -63,8 +63,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1272623
}
add_task(async function() {
maybeOnSpellCheck = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
maybeOnSpellCheck = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
).maybeOnSpellCheck;
// Wait for the page to be ready

View File

@ -12,8 +12,8 @@ x
var p = document.getElementById('p');
var div = p.parentNode;
div.focus();
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
maybeOnSpellCheck(div, function () {
var sel = window.getSelection();

View File

@ -19,8 +19,8 @@ x
sel.addRange(range);
p.parentNode.focus();
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
maybeOnSpellCheck(p.parentNode, function () {
sendKey('DOWN'); // now after "1"

View File

@ -12,8 +12,8 @@ x
var p = document.getElementById('p');
var div = p.parentNode;
div.focus();
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
maybeOnSpellCheck(div, function () {
var sel = window.getSelection();

View File

@ -19,8 +19,8 @@ x
sel.addRange(range);
p.parentNode.focus();
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
maybeOnSpellCheck(p.parentNode, function () {
sendKey('DOWN'); // now after "1"

View File

@ -3,8 +3,8 @@
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script>
document.body.firstChild.focus();
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
maybeOnSpellCheck(document.body.firstChild, function() {
document.documentElement.removeAttribute("class");

View File

@ -4,8 +4,8 @@
<script>
var div = document.body.firstChild;
div.focus();
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"
var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
maybeOnSpellCheck(div, function() {
div.innerHTML = 'something missspelled<br>something elsed#';

View File

@ -44,8 +44,8 @@ function startTests()
inputBox._input.focus();
testNum = 0;
({onSpellCheck} = ChromeUtils.import(
"resource://testing-common/AsyncSpellCheckTestHelper.jsm"));
({onSpellCheck} = ChromeUtils.importESModule(
"resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"));
onSpellCheck(inputBox._input, function () {
bringUpContextMenu(inputBox);
});