/* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ add_task(async function () { await BrowserTestUtils.withNewTab( "data:text/html,
", async function (browser) { await SimpleTest.promiseFocus(browser); for (const test of [ { command: "cut" }, { command: "delete" }, { command: "insertText", data: "B" }, ]) { // ab[]c await SpecialPowers.spawn(browser, [], () => { const textarea = content.document.querySelector("textarea"); textarea.value = "abc"; textarea.focus(); textarea.selectionStart = "ab".length; textarea.selectionEnd = textarea.selectionStart; content.wrappedJSObject.promiseInput = new Promise(resolve => textarea.addEventListener("input", () => resolve(textarea.value), { once: true, }) ); }); // a[b]c window.windowUtils.sendSelectionSetEvent("a".length, "b".length); // a[]c or a[B]c window.windowUtils.sendContentCommandEvent( test.command, null, test.data ); info("Waiting for input event on