Open two windows with the following content: <body> <textarea lang="en-US">this is English text</textarea> </body> and <body> <textarea lang="es-ES">texto en un libro</textarea> </body> Make sure spell checking is enabled for both. Left click on the English window. Now right click on the Spanish window and look at the dictionary popup. Result: The English dictionary is still selected. Debug: ***** nsEditorEventListener::Focus on 1A84B870 ***** nsEditorEventListener::Startwatch on 1A84B870 ****************** en-US <--- Language retrieved for menu ***** mPreferredLang (element) |es-ES| ***** Assigned from element/doc |es-ES| ***** Set |es-ES|. The "current" dictionary is retrieved *before* the language for the element is determined, so we get the previous language. The line after the Startwatch was printed at: https://dxr.mozilla.org/mozilla-central/source/toolkit/modules/InlineSpellChecker.jsm#224 If the two textareas are in the same document, the debug looks much different: ***** nsEditorEventListener::Focus on 0676B1B0 ***** nsEditorEventListener::Startwatch on 0676B1B0 ***** mPreferredLang (element) |es-ES| ***** Assigned from element/doc |es-ES| ***** Set |es-ES|. ****************** es-ES So in one document, everything works fine. This is NOT a regression from bug 697981, since I can reproduce this using this Nightly: 43.0a1 (2015-08-31). (My dictionary changes all landed after 2nd Sept. 2015).
Created attachment 8665150 [details] Video showing the bug The video shows the problem. At the end, the left text area is spell checked in Spanish, however, the menu says English. This is truly puzzling. I can reproduce this problem on the following *debug* builds I've tried: - locally compiled. - Nightly: 43.0a1 (2015-08-31) - Nightly: 42.0a1 (2015-07-31) - Nightly: 39.0a1 (2015-03-23) - the oldest debug build I could find (debug builds seem to be removed after six months). I cannot reproduce the problem on any non-debug build I have tried, I've tried a few Nightly builds from August 2015. Olli, would care to comment. I don't want to bother Ehsan with everything. Or who else could have an idea here? Maybe it's a timing issue. Since it happens only with two windows, and only on debug builds (slower due to debug output), and the spell check is asynchronous, maybe the "current" dictionary is retrieved a tick too early. If it's not visible in normal builds, it's less of an issue, but it's certainly annoying to any developer.
Created attachment 8667164 [details] Picture showing the problem. I'm trying this on different hardware now, and the problem is harder to reproduce, but it still happens occasionally, as one can see in the picture.
Can be reproduced with one window only, see attachment 8667164 [details].