I just tried running my IME with manifest V3 (even though I haven't fully implemented state serialization) and found something discouraging. What I did was:
1. Open chrome://extensions so that I can see the status of my service worker.
2. Try my IME in the address bar (the same thing happens when I use a text editor). It works fine.
3. Wait a while (without actively using the IME) until my service worker goes inactive.
4. Try to input again. The service worker remains inactive and whatever letters I enter goes directly to the address bar.
* In some of my tests, the service worker did go active, but only after I enter the first letter (i.e. first letter went to the address bar and the next ones went to the IME). I couldn't find a pattern on when this happens.
If the service worker had gone active but the IME hadn't worked, then it would probably have been because I didn't properly load the IME state, and I could work on that. But since the service worker didn't go active at all (i.e. it seems that it didn't receive the key event even though I did chrome.input.ime.onKeyEvent.addListener(...) at the top level), I'm not sure if I could do anything about that. Moving to another text area, or deactivating and reactivating the IME, does let the service worker go active, but having to do that every time I ponder for a while with my text editor open is obviously unacceptable user experience.
在2022年3月17日星期四 UTC-7 07:18:23<wOxxOm> 写道: