When `TextComposition` in a content process requests to commit composition, the request is sent to the parent process synchronously. Then, if IME handles the request synchronously, `PuppetWidget::RequestIMEToCommitComposition` dispatches a `eCompositionCommit` event synchronously. However, if IME handles it asynchronously, `RequestIMEToCommitComposition` does nothing and `TextComposition::RequestToCommit` dispatches `eCompositionCommit` or `eCompositionCommitAsIs` before receiving next event (in the most cases). However, the puppet widget won't receive the delayed commit event in this case because `TextComposition::DispatchCompositionEvent` in the parent process does not send the delayed commit event. Therefore, `PuppetWidget::DispatchEvent` cannot notify `TextEventDispatcher` of the commit event. Therefore, `TextEventDispatcher` will have wrong composition state. So, fixing this issue, we need to make `TextComposition::DispatchCompositionEvent` in the parent process should send the commit event as usual. To avoid the `ContentCacheInParent` to misunderstand the native IME's composition state, `TextComposition::RequestToCommit` should not dispatch `eCompositionCommit` nor `eCompositionCommitAsIs` because the event causes `ContentCacheInParent` thinks the composition is actually committed in IME. Differential Revision: https://phabricator.services.mozilla.com/D319302
30 lines
975 B
HTML
30 lines
975 B
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Test for no failure of assertions of composition state management after requesting commit composition</title>
|
|
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
|
<script src="file_ime_state_test_helper.js"></script>
|
|
<script src="file_test_ime_request_commit.js"></script>
|
|
<link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
|
<script>
|
|
"use strict";
|
|
|
|
/* import-globals-from file_ime_state_test_helper.js */
|
|
/* import-globals-from file_test_ime_request_commit.js */
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
SimpleTest.waitForFocus(async () => {
|
|
const tipWrapper = new TIPWrapper(window);
|
|
ok(tipWrapper.isAvailable(), "TextInputProcessor should've been initialized");
|
|
|
|
await runTest(tipWrapper, null, false);
|
|
|
|
SimpleTest.finish();
|
|
});
|
|
</script>
|
|
</head>
|
|
<body></body>
|
|
</html>
|