When nsTextStore needs to dispatch empty text event immediately after compositionstart, it dispatches two text events. One has a whitespace and the other has empty string.
If there is no composition string, nsEditor does nothing if empty text event comes. But of course, it should replace selected text with empty string. Therefore, nsTextEditor dispatches the hacky first event.
The nsEditor's behavior will be fixed by bug 622247. After that, we should remove the hacky event dispatchers.
Created attachment 597269 [details] [diff] [review]
I'm not sure how to test these cases actually, however, our internal code is tested by automated tests which will be landed by bug 622247. So, this patch must be safe.