Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

/* Any copyright is dedicated to the Public Domain.
"use strict";
/* import-globals-from ../file_ime_state_test_helper.js */
/* import-globals-from ../file_test_ime_state_on_readonly_change.js */
Services.scriptloader.loadSubScript(
this
);
Services.scriptloader.loadSubScript(
this
);
add_task(async function () {
await BrowserTestUtils.withNewTab(
async function (browser) {
const tipWrapper = new TIPWrapper(window);
ok(
tipWrapper.isAvailable(),
"TextInputProcessor should've been initialized"
);
const tester = new IMEStateOnReadonlyChangeTester();
for (
let i = 0;
i < IMEStateOnReadonlyChangeTester.numberOfTextControlTypes;
i++
) {
const expectedResultBefore = await SpecialPowers.spawn(
browser,
[i],
aIndex => {
content.wrappedJSObject.runner =
content.wrappedJSObject.createIMEStateOnReadonlyChangeTester(
aIndex
);
return content.wrappedJSObject.runner.prepareToRun(
aIndex,
content.window,
content.document.body
);
}
);
tester.checkBeforeRun(expectedResultBefore, tipWrapper);
const expectedResultOfMakingTextControlReadonly =
await SpecialPowers.spawn(browser, [], () => {
return content.wrappedJSObject.runner.runToMakeTextControlReadonly();
});
tester.checkResultOfMakingTextControlReadonly(
expectedResultOfMakingTextControlReadonly
);
const expectedResultOfMakingTextControlEditable =
await SpecialPowers.spawn(browser, [], () => {
return content.wrappedJSObject.runner.runToMakeTextControlEditable();
});
tester.checkResultOfMakingTextControlEditable(
expectedResultOfMakingTextControlEditable
);
tipWrapper.clearFocusBlurNotifications();
tester.clear();
}
}
);
});