Last Comment Bug 849172 - Java applets don't get key release events from browser
: Java applets don't get key release events from browser
Status: NEW
: regression, testcase
Product: Core
Classification: Components
Component: Plug-ins (show other bugs)
: 2.0 Branch
: x86_64 Mac OS X
P3 normal with 1 vote (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Benjamin Smedberg [:bsmedberg]
Depends on:
  Show dependency treegraph
Reported: 2013-03-08 02:33 PST by grosskopf
Modified: 2013-04-17 06:02 PDT (History)
5 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Test case applet (3.18 KB, application/octet-stream)
2013-03-08 06:44 PST, grosskopf
no flags Details

Description User image grosskopf 2013-03-08 02:33:13 PST
When I run a java applet in Firefox listening for key events, the applet gets KEY_PRESSED and KEY_TYPED events, but doesn't get KEY_RELEASED events.
I tested this with Mac OS X 10.8.2, Java 1.7.0_17 and FireFox 19.0.2.
The same applet gets KEY_RELEASED events when started in Safari (Mac OS) or FireFox (Windows 7).
This bug can be reproduced always.
Comment 1 User image Benjamin Smedberg [:bsmedberg] 2013-03-08 06:16:19 PST
Can you provide a minimal testcase? At this point I don't think this is a priority for my team, so I'd be happy for a volunteer to take this.
Comment 2 User image grosskopf 2013-03-08 06:44:02 PST
Created attachment 722785 [details]
Test case applet

Open KeyReleaseTest.html in Firefox.
Comment 3 User image grosskopf 2013-03-08 06:49:21 PST
I added a minimal test case applet.
Open KeyReleaseTest.html in Firefox. You should see the applet as a red box (size 320x200 pixels). When you click it with your mouse you will see "Mouse pressed" on the console. Press a key and the output will be "Key pressed ..." and "Key typed ..." but no "Key released ...".
Here is the source code of the applet:

import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JApplet;

public class KeyReleaseTestApplet extends JApplet {
	public void init() {
		addMouseListener( new MouseAdapter() {
			public void mousePressed( MouseEvent e) {
				System.out.println( "Mouse pressed.");
		addKeyListener( new KeyListener() {
			public void keyTyped( KeyEvent e) {
				System.out.println( "Key typed. e="+e);
			public void keyReleased( KeyEvent e) {
				System.out.println( "Key released. e="+e);
			public void keyPressed( KeyEvent e) {
				System.out.println( "Key pressed. e="+e);
	public void paint(Graphics gr) {
		gr.fillRect( 0,0,getWidth(), getHeight());
Comment 4 User image Benjamin Smedberg [:bsmedberg] 2013-03-08 06:56:20 PST
Thank you!
Comment 5 User image Steven Michaud [:smichaud] (Retired) 2013-03-08 08:43:06 PST
Reporter, does this bug also happen with older versions of Firefox?

And if not, would you be willing to test trunk (aka mozilla-central) nightlies to find out in which this bug started happening?

This is something a volunteer could do.  But knowing the regression range might make a volunteer more likely to be interested in working on this bug.
Comment 6 User image grosskopf 2013-03-08 08:50:23 PST
This bug appears in older versions, too. Probably since Firefox 13:
Comment 7 User image Scoobidiver (away) 2013-03-08 09:30:03 PST
Can you run to find a regression range?
Comment 8 User image Benjamin Smedberg [:bsmedberg] 2013-03-08 09:40:17 PST
So far we don't know that it ever worked.
Comment 9 User image grosskopf 2013-03-11 02:56:53 PDT
Running the mozregression tool I found that key released events worked until nightly build from 2011-01-20. In 2011-01-21 it is broken.
Comment 10 User image Scoobidiver (away) 2013-03-11 03:05:18 PDT
The regression range is
I suspect bug 583499.
Comment 11 User image Benjamin Smedberg [:bsmedberg] 2013-03-11 09:59:17 PDT
That's a bit surprising, but I don't see anything else in the range.
Comment 12 User image grosskopf 2013-03-12 03:25:40 PDT
I have an additional information:
The bug only appears with Java 7.
Comment 13 User image grosskopf 2013-04-17 06:02:30 PDT
Since Java 1.7.0_21 it is broken in Safari, too. So maybe this is an Jave/Oracle issue.

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