Bug 62693 - windowsKeyCodeForKeyEvent should be robust against NSFlagsChanged events
Summary: windowsKeyCodeForKeyEvent should be robust against NSFlagsChanged events
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: John Sullivan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2011-06-14 20:42 PDT by John Sullivan
Modified: 2011-06-14 22:40 PDT (History)
3 users (show)

See Also:


Attachments
Patch to bail out of windowsKeyCodeForKeyEvent for NSFlagsChanged events (1.33 KB, patch)
2011-06-14 20:45 PDT, John Sullivan
adachan: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Sullivan 2011-06-14 20:42:02 PDT
The function windowsKeyCodeForKeyEvent() in WebEventFactory.mm does not explicitly check for NSFlagsChanged events before calling -charactersIgnoringModifiers. -[NSEvent charactersIgnoringModifiers] throws an exception for NSFlagsChanged events. We should make this function avoid this possibility.

In Radar as <rdar://problem/9601436>
Comment 1 John Sullivan 2011-06-14 20:45:55 PDT
Created attachment 97227 [details]
Patch to bail out of windowsKeyCodeForKeyEvent for NSFlagsChanged events
Comment 2 John Sullivan 2011-06-14 20:53:27 PDT
Fixed in http://trac.webkit.org/changeset/88903
Comment 3 Sam Weinig 2011-06-14 21:45:02 PDT
John, is there a particular key combination that produces this exception.  If so, we should consider at least documenting it here, and if possible, writing an API test for this.
Comment 4 John Sullivan 2011-06-14 21:47:17 PDT
Don’t know of the key code that’s causing the exception, but stack traces from crashes show that it is happening.
Comment 5 Darin Adler 2011-06-14 22:20:43 PDT
Wouldn’t a white list be better than a black list for event types?
Comment 6 Alexey Proskuryakov 2011-06-14 22:35:35 PDT
If this is reproducible, can you just post what event causes this, and a stack trace?

A switch above this code seems to handle all keys that can cause NSFlagsChanged. And if it misses some, we should find out which ones, and return a proper Windows key code for these, not a zero.
Comment 7 Alexey Proskuryakov 2011-06-14 22:40:55 PDT
Actually, I see this info in Radar, and it seems like the NSEvent is somehow invalid. I don't know how an event could have key code 49808. Are we dealing with some sort of a memory consistency issue here?