Bug 1283582 - Stop displaying the context menu in Fennec if web content did a preventDefault on the event. r=margaret
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 05 Jul 2016 10:09:38 -0400
changeset 303697 f0c70bfa8917bbb0ecd1939e40fa565377e203eb
parent 303696 f08c54971dd185850d9f2abae42d604f5e820918
child 303698 fe73f3d7e160498b6c27f876e0c12b79df2edaa6
push id79142
push userkgupta@mozilla.com
push dateTue, 05 Jul 2016 14:09:52 +0000
treeherdermozilla-inbound@f0c70bfa8917 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1283582
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1283582 - Stop displaying the context menu in Fennec if web content did a preventDefault on the event. r=margaret MozReview-Commit-ID: 4JQwXNfJxip
mobile/android/chrome/content/browser.js
--- 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