Bug 787619 - Prevent clicks on the click-to-play placeholder triggering other handlers. r=jaws, a=lsblakk
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Fri, 19 Oct 2012 15:11:04 +0200
changeset 116306 496b5931379e3922276506402c066eb87a40135c
parent 116305 34aca404c1d61f8d911db89b4835199048bc1200
child 116307 ab6323dea35897b7467df71d1cf4f6436386ebb3
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-beta@27b14fe50103 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, lsblakk
bugs787619
milestone18.0a2
Bug 787619 - Prevent clicks on the click-to-play placeholder triggering other handlers. r=jaws, a=lsblakk
browser/base/content/browser-plugins.js
--- a/browser/base/content/browser-plugins.js
+++ b/browser/base/content/browser-plugins.js
@@ -321,18 +321,21 @@ var gPluginHandler = {
       return;
     }
 
     // The overlay is null if the XBL binding is not attached (element is display:none).
     if (overlay) {
       overlay.addEventListener("click", function(aEvent) {
         // Have to check that the target is not the link to update the plugin
         if (!(aEvent.originalTarget instanceof HTMLAnchorElement) &&
-            aEvent.button == 0 && aEvent.isTrusted)
+            aEvent.button == 0 && aEvent.isTrusted) {
           gPluginHandler.activateSinglePlugin(aEvent.target.ownerDocument.defaultView.top, aPlugin);
+          aEvent.stopPropagation();
+          aEvent.preventDefault();
+        }
       }, true);
     }
 
     if (!browser._clickToPlayDoorhangerShown)
       gPluginHandler._showClickToPlayNotification(browser);
   },
 
   _handlePlayPreviewEvent: function PH_handlePlayPreviewEvent(aPlugin) {