Open Bug 1320308 Opened 8 years ago Updated 3 months ago

[Windows] Dead key may be typed automatically when you type in another application and Firefox is starting

Categories

(Core :: DOM: UI Events & Focus Handling, defect, P3)

All
Windows 10
defect

Tracking

()

People

(Reporter: rinnkazul, Unassigned)

References

Details

(Keywords: inputmethod, regression, Whiteboard: tpi:+)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0
Build ID: 20161104212021

Steps to reproduce:

This will happen much more often/reproduicibly if you have a slow CPU (something like low tier mobile celeron or atom CPU). Right after firefox (i.e. launcing the exe or clicking on the firefox icon) and before the UI appears, try typing into a rich text editor window (for example wordpad or elsewhere).


Actual results:

Until the UI appears, you might notice that weird symbols will be inserted randomly into what you're typing. Example below:

1) clicked launch firefox
2) switched to chat program before firefox loaded and started typing "Went early to pick up a parcel"
3) this ended up on screen instead:

"Went·éa°r^ly¸to pick up a parcel"

The characters inserted are very, very random.

Something to note is that this issue has existed since a very long time ago (firefox 20+), but it had recently become more pronounced as I started using a slower computer.


Expected results:

Firefox loading shouldn't impair my typing or modify typed text in any way.
OS: Unspecified → Windows 10
Hardware: Unspecified → x86_64
As stated previously, this has been happening since a long time ago. Firefox 20 x86 w/ Windows 7 is when I noticed it first, running on an Atom CPU.
See this recording of the issue. In the recording, I start firefox and begin typing something random. You can see that just before the firefox GUI appears, weird symbols are inserted into the typed text.

http://imgur.com/L9J74xP
Are you able to reproduce the issue at 100% when you start Firefox?
100% . I get varying amounts of the "corruption" and the symbols are also different every time, but it always happens - if I'm typing during the "launch" period. Only with slow CPUs however. The slower the CPU the more corruption you get (rather, the longer the timeslot during which corruption occurs is)
Hello, 

Thanks for reporting this issue. 

Does this happen when you try to work with any other application?
Flags: needinfo?(rinnkazul)
Hi,

Nope, just Firefox. Initially I thought maybe something gets messed up when my cpu utilization is high, but the computer is unaffected if I run prime95 and try to type. And I've never had it happen with any other applications with "long launchtime", so to speak. So while I cannot confirm it's just firefox, I can confirm it never happened with any other application.
Flags: needinfo?(rinnkazul)
Maybe this way to explore: can you try to install the tool mozregression http://mozilla.github.io/mozregression/ to narrow down a regression range as you said it started after Firefox 20.
If you install the command-line version, you need python 2.7 (see the install documentation).

The tool will start nightly builds automatically so you have to test during this timing.
So I did a bunch of tests. I was having trouble with the tool so instead I used a virtual machine and snapshots.

I always deleted the mozilla profile directores ( local/mozilla and roaming/mozilla ) to make sure the profile was completely clean.

I used a completely clean profile for all the tests. I found that I can just hold down "a" and if any weird symbols come up, they'll show in the continuous stream of a's typed by the letter repetition. I always started holding down the letter right after launching firefox, or as close as humanly possible (~150-200msec)

I did 20 startups of each browser version below, noting down the corruptions.

It's worth noting that _EVERY_ browser (including firefox 3) experienced heavy text corruption after the profiles were deleted, i.e. the "first start", if you will. Before the "import wizard" screen appears, heavy corruption was observed, regardless of version (3-50). See sample of such corruption below:

"aaaaáaaäåˇaååa˝a˝aˇaˇaăaaaaaaa˙aaáäa¸aááä䡡aaaááääˇa˝a˝aaaaˇˇaaâââaăåaåaaaąaąààaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

All of these runs are then done for the "2nd launch and onwards" of a given browser. I think the above information is relevant but I also don't understand how exactly or why. Also worth noting that during the first start, I set up all of the foxes to not look for updates so as to not affect my testing, but otherwise all of the options and settings are completely default as they are generated when you install fresh fox.

Firefox 3 - Only light corruption (just the first letter), but 9 out of 20 times. All of the subsequent letters were unaffected.

Firefox 5 - 3 out of 20 times, very heavy corruption. 2 times light corruption (just first letter).

Firefox 10 - 8 out of 20 times, very heavy corruption. 1 time light corruption (just the first letter).

Firefox 20 - 7 out of 20 times, very heavy corruption.

Firefox 30 - 20 out of 20 times, very heavy corruption.

Firefox 40 - 20 out of 20 times, very heavy corruption.

Firefox 50 - 20 out of 20 times, very heavy corruption.

So I went to narrow it down further, firefox 25 - 20/20. Firefox 23 - 9/20. Firefox 24 - 15/20.

I then went to firefox 3 to doublecheck it and got similar results to my initial test. Reinstalled firefox 25 back, always got the corruption. So whatever it is was a longer process and it got way worse around firefox 25 when it became persistent; but it was noticable since firefox 10 already - though back then I wasn't running firefox 10, I was still on 3.6; so I can't tell you more.

Summary: issue basically doesn't exist on firefox ~3, is very minor on 5, is moderate on 10-20 and is major on 25+ .

Please see below an example of me launching firefox 3:

https://imgur.com/a/mrru6

and an example of launching firefox 25:

https://imgur.com/a/JbhpM

If you need anything else, please let me know!
What is your locale and input method on Windows, is English (United States)?
Flags: needinfo?(rinnkazul)
Locale is US.
Input is US but keyboard layout is "Czech".

https://imgur.com/a/0u2eq
Flags: needinfo?(rinnkazul)
I can reproduce the problem with Fx4.0.1 & 10.0 & 51.0b8 x64 and clean profile on Win10 x64 (zh-CN) with "Czech" keyboard layout.

It happens to me less, probably because I have a medium CPU but HDD.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Hardware: x86_64 → All
Summary: Upon launching firefox (but before the UI appears), typing (anywhere) causes weird symbols to be inserted randomly → Upon launching firefox (but before the UI appears), typing (anywhere) causes weird symbols to be inserted randomly, in keyboard layout is "Czech"
Version: 50 Branch → unspecified
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0

I have tested again the reported issue on latest FF release (50.1.0), latest Nightly build (20161219030207) and managed to reproduce it. I have set my keyboard layout to "Czech (QWERTY)", which do the job to uncover this issue for me. I wasn't able to reproduce it with en-US locale.

Firefox 50 - 10 from 20 times, light corruption.
To confirm the opposite case, I switched my keyboard layout to "US" prior to launching Mozilla and couldn't reproduce it anymore, more or less confirming it's because of the czech keyboard layout.

So a summary:
- Happens with czech keyboard layout
- Happens on any FF from version 3 onwards
- The amount of corruption depends almost linearly on the speed of your CPU and storage - if they're fast, you will see lower or no corruption, if it's slow, you'll see heavy corruption.
Component: Untriaged → Widget: Win32
Keywords: inputmethod
Product: Firefox → Core
Version: unspecified → Trunk
Masayuki, do you have an idea why the CZ keyboard could imply typing issues when Firefox is starting?
Flags: needinfo?(masayuki)
Actually, not.

However, I rewrote keyboard event handling code of Windows as same as usual Windows applications. Could you check if 52 (Currently Developer Edition) still has this bug?
https://www.mozilla.org/en-US/firefox/channel/desktop/?v=b
Flags: needinfo?(masayuki) → needinfo?(rinnkazul)
Oops, it's already been tested at comment 12.
Flags: needinfo?(rinnkazul)
Yup, though just to comply with your request, I tested it with the dev mozilla ( 52.0a2 (2016-12-20) ) and the issue is still present (with cs keyboard layout).
I'd like to see the log of native keyboard message handler at launching.

Developer Edition and Nightly can log the behavior (bug 1297013). For getting the log, you need to set following env:

MOZ_LOG=NativeKeyWidgets:5,sync
MOZ_LOG_FILE=c:\Users\<user name>\fx.log
(You can specify any path to MOZ_LOG_FILE)

Please be careful, you shouldn't type any your privacy because the log will record any text which you type.

After you took the log, please attach the file to this bug from "Add an attachment" link of this bug.
Hi!

The log is empty. It only starts logging when I type something within Mozilla, but this is not the issue in this case. The issue exists with any text typed during the startup of mozilla (but before the UI appears). I cannot capture the log this way, or I need a different log parameter that works during startup.
I also got the empty log file on Win10, with comment 18.
Priority: -- → P3
Whiteboard: tpi:+
Is it reproducible if you try with 2 profiles with Firefox:
1) start FF with profile 1
2) start FF with profile 2 (-no-remote)
3) when starting profile 2, type something in profile 1
That works. Log attached. Starting second profile whilst holding "a" in the first profile.

Got:

aaaaaaaaaaaaaaaaaaaaaaaaaaaˇaåaa¸aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

and it even shows in the log:

[Main Thread]: V/NativeKeyWidgets 3ae9e8   NativeKey::GetFollowingCharMessage(), succeeded to retrieve next char message, aCharMsg={ message=WM_CHAR, character code='å' (0x00E5), repeat count=1, scancode=0x1E, extended key=false, context code=false, previous key state=true, transition state=false, hwnd=0x5201c0
[Main Thread]: I/NativeKeyWidgets 3ae9e8   NativeKey::InitWithKeyChar(), removed char message, { message=WM_CHAR, character code='å' (0x00E5), repeat count=1, scancode=0x1E, extended key=false, context code=false, previous key state=true, transition state=false, hwnd=0x5201c0
Attached file fx.log
Attachment #8820796 - Attachment mime type: text/x-log → text/plain
Thank you for the log file.

```
> [Main Thread]: I/NativeKeyWidgets 3ae9e8 NativeKey::NativeKey(aWidget=0xe0b5000 { GetWindowHandle()=0x5201c0 }, aMessage={ message=WM_KEYDOWN, virtual keycode=VK_A, repeat count=1, scancode=0x1E, extended key=false, context code=false, previous key state=true, transition state=false, hwnd=0x5201c0, aModKeyState={ NumLock }), sLatestInstance=0x0
> [Main Thread]: V/NativeKeyWidgets 3ae9e8   NativeKey::GetFollowingCharMessage(), succeeded to retrieve next char message, aCharMsg={ message=WM_CHAR, character code='å' (0x00E5), repeat count=1, scancode=0x1E, extended key=false, context code=false, previous key state=true, transition state=false, hwnd=0x5201c0
> [Main Thread]: I/NativeKeyWidgets 3ae9e8   NativeKey::InitWithKeyChar(), removed char message, { message=WM_CHAR, character code='å' (0x00E5), repeat count=1, scancode=0x1E, extended key=false, context code=false, previous key state=true, transition state=false, hwnd=0x5201c0
> [Main Thread]: V/NativeKeyWidgets 3ae9e8   NativeKey::GetFollowingCharMessage(), there are no char messages
> [Main Thread]: I/NativeKeyWidgets 3ae9e8   NativeKey::NativeKey(), mKeyboardLayout=0x04050405, mFocusedWndBeforeDispatch=0x5201c0, mDOMKeyCode=0x6F612704, mKeyNameIndex=USE_STRING, mCodeNameIndex=KeyA, mModKeyState={ NumLock }, mVirtualKeyCode=VK_A, mOriginalVirtualKeyCode=VK_A, mCommittedCharsAndModifiers={ 'å' (0x00E5) [NumLock] }, mInputtingStringAndModifiers={}, mShiftedString={}, mUnshiftedString={}, mShiftedLatinChar=NULL (0x0000), mUnshiftedLatinChar=NULL (0x0000), mScanCode=0x001E, mIsExtended=false, mIsDeadKey=false, mIsPrintableKey=true, mIsOverridingKeyboardLayout=false
> [Main Thread]: D/NativeKeyWidgets 3ae9e8   NativeKey::HandleKeyDownMessage(), initializing keydown event...
> [Main Thread]: I/NativeKeyWidgets 3ae9e8   NativeKey::InitKeyEvent(), initialized, aKeyEvent={ mMessage=eKeyDown, mKeyNameIndex=USE_STRING, mKeyValue="å", mCodeNameIndex=KeyA, mKeyCode=VK_A, mLocation=KEY_LOCATION_STANDARD, mModifiers=NumLock, DefaultPrevented()=false }
> [Main Thread]: I/NativeKeyWidgets 3ae9e8   NativeKey::HandleKeyDownMessage(), dispatching keydown event...
> [Main Thread]: I/NativeKeyWidgets 3ae9e8   NativeKey::HandleKeyDownMessage(), dispatched keydown event, dispatched=true, defaultPrevented=false
> [Main Thread]: I/NativeKeyWidgets 3ae9e8   NativeKey::HandleKeyDownMessage(), tries to be dispatching keypress events with retrieved char messages...
> [Main Thread]: D/NativeKeyWidgets 3ae9e8   NativeKey::DispatchKeyPressEventsWithRetrievedCharMessages(), initializing keypress event...
> [Main Thread]: I/NativeKeyWidgets 3ae9e8   NativeKey::InitKeyEvent(), initialized, aKeyEvent={ mMessage=eKeyPress, mKeyNameIndex=USE_STRING, mKeyValue="å", mCodeNameIndex=KeyA, mKeyCode=Invalid DOM keyCode (0x00000000), mLocation=KEY_LOCATION_STANDARD, mModifiers=NumLock, DefaultPrevented()=false }
> [Main Thread]: I/NativeKeyWidgets 3ae9e8   NativeKey::DispatchKeyPressEventsWithRetrievedCharMessages(), dispatching keypress event(s)...
> [Main Thread]: I/NativeKeyWidgets 3ae9e8   NativeKey::DispatchKeyPressEventsWithRetrievedCharMessages(), dispatched keypress event(s), dispatched=true, consumed=false
> [Main Thread]: D/NativeKeyWidgets 3ae9e8   NativeKey::~NativeKey(), destroyed
```

When "KeyA" inputs "å", we really received WM_CHAR for "å".

```
> [Main Thread]: I/NativeKeyWidgets 3aea08 NativeKey::NativeKey(aWidget=0xe0b5000 { GetWindowHandle()=0x5201c0 }, aMessage={ message=WM_KEYDOWN, virtual keycode=VK_A, repeat count=1, scancode=0x1E, extended key=false, context code=false, previous key state=true, transition state=false, hwnd=0x5201c0, aModKeyState={ NumLock }), sLatestInstance=0x0
> [Main Thread]: V/NativeKeyWidgets 3aea08   NativeKey::GetFollowingCharMessage(), succeeded to retrieve next char message, aCharMsg={ message=WM_CHAR, character code='ˇ' (0x02C7), repeat count=1, scancode=0x1E, extended key=false, context code=false, previous key state=true, transition state=false, hwnd=0x5201c0
> [Main Thread]: I/NativeKeyWidgets 3aea08   NativeKey::InitWithKeyChar(), removed char message, { message=WM_CHAR, character code='ˇ' (0x02C7), repeat count=1, scancode=0x1E, extended key=false, context code=false, previous key state=true, transition state=false, hwnd=0x5201c0
> [Main Thread]: V/NativeKeyWidgets 3aea08   NativeKey::GetFollowingCharMessage(), succeeded to retrieve next char message, aCharMsg={ message=WM_CHAR, character code='a' (0x0061), repeat count=1, scancode=0x1E, extended key=false, context code=false, previous key state=true, transition state=false, hwnd=0x5201c0
> [Main Thread]: I/NativeKeyWidgets 3aea08   NativeKey::InitWithKeyChar(), removed char message, { message=WM_CHAR, character code='a' (0x0061), repeat count=1, scancode=0x1E, extended key=false, context code=false, previous key state=true, transition state=false, hwnd=0x5201c0
> [Main Thread]: V/NativeKeyWidgets 3aea08   NativeKey::GetFollowingCharMessage(), there are no char messages
> [Main Thread]: I/NativeKeyWidgets 3aea08   NativeKey::NativeKey(), mKeyboardLayout=0x04050405, mFocusedWndBeforeDispatch=0x5201c0, mDOMKeyCode=0x6F612704, mKeyNameIndex=USE_STRING, mCodeNameIndex=KeyA, mModKeyState={ NumLock }, mVirtualKeyCode=VK_A, mOriginalVirtualKeyCode=VK_A, mCommittedCharsAndModifiers={ 'ˇ' (0x02C7), 'a' (0x0061) [NumLock] }, mInputtingStringAndModifiers={}, mShiftedString={}, mUnshiftedString={}, mShiftedLatinChar=NULL (0x0000), mUnshiftedLatinChar=NULL (0x0000), mScanCode=0x001E, mIsExtended=false, mIsDeadKey=false, mIsPrintableKey=true, mIsOverridingKeyboardLayout=false
> [Main Thread]: D/NativeKeyWidgets 3aea08   NativeKey::HandleKeyDownMessage(), initializing keydown event...
> [Main Thread]: I/NativeKeyWidgets 3aea08   NativeKey::InitKeyEvent(), initialized, aKeyEvent={ mMessage=eKeyDown, mKeyNameIndex=USE_STRING, mKeyValue="ˇa", mCodeNameIndex=KeyA, mKeyCode=VK_A, mLocation=KEY_LOCATION_STANDARD, mModifiers=NumLock, DefaultPrevented()=false }
> [Main Thread]: I/NativeKeyWidgets 3aea08   NativeKey::HandleKeyDownMessage(), dispatching keydown event...
> [Main Thread]: I/NativeKeyWidgets 3aea08   NativeKey::HandleKeyDownMessage(), dispatched keydown event, dispatched=true, defaultPrevented=false
> [Main Thread]: I/NativeKeyWidgets 3aea08   NativeKey::HandleKeyDownMessage(), tries to be dispatching keypress events with retrieved char messages...
> [Main Thread]: D/NativeKeyWidgets 3aea08   NativeKey::DispatchKeyPressEventsWithRetrievedCharMessages(), initializing keypress event...
> [Main Thread]: I/NativeKeyWidgets 3aea08   NativeKey::InitKeyEvent(), initialized, aKeyEvent={ mMessage=eKeyPress, mKeyNameIndex=USE_STRING, mKeyValue="ˇa", mCodeNameIndex=KeyA, mKeyCode=Invalid DOM keyCode (0x00000000), mLocation=KEY_LOCATION_STANDARD, mModifiers=NumLock, DefaultPrevented()=false }
> [Main Thread]: I/NativeKeyWidgets 3aea08   NativeKey::DispatchKeyPressEventsWithRetrievedCharMessages(), dispatching keypress event(s)...
> [Main Thread]: I/NativeKeyWidgets 3aea08   NativeKey::WillDispatchKeyboardEvent(), setting 1th modifier state to { NumLock }
> [Main Thread]: I/NativeKeyWidgets 3aea08   NativeKey::WillDispatchKeyboardEvent(), does nothing for 1th eKeyPress event
> [Main Thread]: I/NativeKeyWidgets 3aea08   NativeKey::WillDispatchKeyboardEvent(), setting 2th modifier state to { NumLock }
> [Main Thread]: I/NativeKeyWidgets 3aea08   NativeKey::WillDispatchKeyboardEvent(), does nothing for 2th eKeyPress event
> [Main Thread]: I/NativeKeyWidgets 3aea08   NativeKey::DispatchKeyPressEventsWithRetrievedCharMessages(), dispatched keypress event(s), dispatched=true, consumed=false
> [Main Thread]: D/NativeKeyWidgets 3aea08   NativeKey::~NativeKey(), destroyed
```

Similarly, when "KeyA" inputs "ˇa", we received 2 WM_CHAR messages for both "ˇ" and "a".

So, it seems that this is not our bug. WM_CHAR is generated when application calls TranslateMessage() with WM_KEYDOWN (it converted by a DLL of keyboard layout or active IME).

Does something affect to this symptom when you change "intl.tsf.enable", "intl.tsf.support_imm" or "intl.keyboard.per_window_layout" from about:config?
Hi,

I tried toggling all three, but that (nor any of the combinations) made a change.

If this is not your bug, whose bug is it? (i.e. where to report it?) similarly, why can't I reproduce it with any other program? It only happens with firefox/thunderbird. 

None of the other long-launching software does this. Any suggestions so as what I should try?
Also, about "receiving" the weird symbols, that much is apparent because the issue manifests when I start firefox/thunderbird and then start typing anywhere. (like a skype chat or text document in notepad or anywhere). There is no question that these characters are really received. The problem is that it seems like they are generated because of mozilla's startup procedure.
See Also: → 1329590

Moving all open keyboard/IME handling bugs to DOM: UI Events & Focus Handling component.

Component: Widget: Win32 → DOM: UI Events & Focus Handling

Ah, probably, I got it. This is reproducible only when keyboard layouts which have dead key.

When we create a first window, we load all characters with all modifiers. At this time, we set keyboard state. In my understanding, the state is independent per process, but I guess I'm wrong.

So, I think that we should put it off to load keyboard layout information.

Summary: Upon launching firefox (but before the UI appears), typing (anywhere) causes weird symbols to be inserted randomly, in keyboard layout is "Czech" → [Windows] Dead key may be typed automatically when you type in another application and Firefox is starting

Bugbug thinks this bug is a regression, but please revert this change in case of error.

Keywords: regression
Severity: normal → S3

This should be fixed once bug 1878224 is fixed.

Depends on: 1878224
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: