Mozilla /5.0 (Android;Linux armv7l;rv:9.0a1) Gecko/20111003 Firefox/10.0a1 Fennec/10.0a1
Device" LG Optimus 2X
Steps to reproduce:
1. go to any page
2. long tap on a link or an image
3. after the context menu appears hit the system back button
Actual results:
nothing happens
Expected results:
the context menu should close

Created attachment 564959[details][diff][review]
patch
So, we removed our custom JavaScript key event forwarding, and started letting the platform forward key events for us (bug 682017).
This broke keyboard shortcuts, so we restored part of our JavaScript code to pass key events back from content to chrome and re-dispatch them (bug 683736).
The re-dispatching caused handleEscape to get called twice for the same key press in some cases. We fixed this by making handleEscape wait for events to bubble up to the window, instead of capturing them on the way down. Then we could stop forwarded events from bubbling (bug 684558).
But this broke cases where the events don't bubble, like in the awesomescreen. We fixed that by going back to capturing, but ignoring the event the first time, when it's headed toward the browser (bug 691175).
But that doesn't work for cases where the event is heading toward the browser but isn't forwarded to content; then we won't handle the event at all. So this patch instead handles the event the first time, but ignores it the second time when it's redispatched by KeyFilter.
This fixes the bug, and does not regress any of the related bugs or tests, and is not any hackier than what was here before. I'll write a new test for this regression before checking in the patch, and I'm still working on understanding the platform logic here and how we need to work with it or fix it.