Bug 1283582 - Stop displaying the context menu in Fennec if web content did a preventDefault on the event. r?margaret
MozReview-Commit-ID: 88PMQt2IiNs
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -2673,16 +2673,22 @@ var NativeWindow = {
*/
show: function(event) {
// Android Long-press / contextmenu event provides clientX/Y data. This is not provided
// by mochitest: test_browserElement_inproc_ContextmenuEvents.html.
if (!event.clientX || !event.clientY) {
return;
}
+ // If the event was already defaultPrevented by somebody (web content, or
+ // some other part of gecko), then don't do anything with it.
+ if (event.defaultPrevented) {
+ return;
+ }
+
// Use the highlighted element for the context menu target. When accessibility is
// enabled, elements may not be highlighted so use the event target instead.
this._target = BrowserEventHandler._highlightElement || event.target;
if (!this._target) {
return;
}
// Try to build a list of contextmenu items. If successful, actually show the