Open Bug 1216541 Opened 10 years ago Updated 3 years ago

BrowserTestUtils.sendChar should fire key events in parent process

Categories

(Testing :: Mochitest, defect)

defect

Tracking

(Not tracked)

People

(Reporter: enndeakin, Unassigned)

References

Details

The implementation is redirecting key events to the child process which is incorrect. Synthesized keys should be sent to the parent process which will send them to the child as needed. This more properly mimics the way that real keys behave. The current BrowserTestUtils.sendChar implementation will send a key event to a browser that may not be focused, leading to possible errors. You can see this issue with the following: add_task(function *() { const TEST_PAGE_URI = "data:text/html,<input autofocus>"; let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PAGE_URI); gURLBar.focus(); yield new Promise(r => setTimeout(r, 2000)); yield BrowserTestUtils.sendChar("a", tab.linkedBrowser); }); where the character gets entered into the input field despite that the browser is not focused.
Component: BrowserTest → Mochitest
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.