Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 334809

Summary: [client] Warning in Firefox Error Console when querying charCode of a key event
Product: [RT] RAP Reporter: Rüdiger Herrmann <ruediger.herrmann>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: tbuschto
Version: unspecified   
Target Milestone: 1.4 M5   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed patch none

Description Rüdiger Herrmann CLA 2011-01-19 11:24:12 EST
Steps to reproduce:
* open an arbitrary RAP application in Firefox 3.6
* hit some keys
-> the following warning appears in the Error Console (Tools -> Error Console)
  Warning: The 'charCode' property of a keydown event should not be used. The value is meaningless.

event.charCode reference documentation on MDN:
  https://developer.mozilla.org/en/DOM/event.charCode#Notes
Comment 1 Tim Buschtoens CLA 2011-01-21 05:59:53 EST
Hi!

This is because the EventHandlerUtil#getCharCode works independently from the type of the event. However, the underlying abstraction (EventHandler.js) is not using the value, its just for simplicity that the data is collected before this decision is made. To supress this warning would mean to add or refactor some relatively sensitive code, so i'm leaning towards closing this as a wontfix. That is unless you think keeping the error-console clear of warnings is worth that.
Comment 2 Rüdiger Herrmann CLA 2011-01-21 15:23:27 EST
I would weight an empty error-console over the risk of introducing a regression.
This issue renders the error-console useless as it fills it with hundrets of messages and one will most likely miss other maybe more relevant entries.
_If_ you fix this, be aware that there is another occurence of event.charCode in AsyncKeyEventUtil#_getEventInfo.
Comment 3 Rüdiger Herrmann CLA 2011-01-21 15:29:58 EST
Created attachment 187325 [details]
Proposed patch
Comment 4 Ralf Sternberg CLA 2011-01-22 05:29:20 EST
+1 for a clean error console.
Accepting those warnings is a no-go in my eyes not only because it renders the console useless but also as it leaves the impression of an immature framework!
Comment 5 Tim Buschtoens CLA 2011-01-24 06:21:17 EST
Patch passed javascript tests, commited to CVS HEAD.
Comment 6 Rüdiger Herrmann CLA 2011-01-24 06:28:31 EST
Is it feasible to have a test case that specifically tests that charCode isn't queried in keyup and keydown events?
Comment 7 Tim Buschtoens CLA 2011-01-24 10:46:14 EST
No, you cant test if a field is read or not. If it were a getter, sure, but not in this case.