Bug 1783178: Wait for the caret event in browser_caching_text_bounds.js instead of the focus event. r=eeejay

The caret event might fire after focus, in which case the cached caret would be incorrect.

Differential Revision: https://phabricator.services.mozilla.com/D172538
This commit is contained in:
James Teh 2023-03-15 01:00:37 +00:00
Родитель 041e0afce5
Коммит 21d4739a57
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -562,13 +562,14 @@ addAccessibleTask(
async function(browser, docAcc) {
const input = findAccessibleChildByID(docAcc, "input", [nsIAccessibleText]);
info("Setting caret and focusing input");
let focused = waitForEvent(EVENT_FOCUS, input);
let caretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, input);
await invokeContentTask(browser, [], () => {
const inputDom = content.document.getElementById("input");
inputDom.selectionStart = inputDom.selectionEnd = 1;
inputDom.focus();
});
await focused;
await caretMoved;
is(input.caretOffset, 1, "input caretOffset is 1");
let expectedX = {};
let expectedY = {};
let expectedW = {};