Bug 787619 - Prevent clicks on the click-to-play placeholder triggering other handlers. r=jaws
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Fri, 19 Oct 2012 15:11:04 +0200
changeset 111001 3d23e8d2f87a59f5b344ebd0447b8b5b69fffec6
parent 111000 0cdf460897ead96eaf4c7a4ce3af3df6a7933003
child 111002 404557eb178698a43e82c9f04e244258c255e61b
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjaws
bugs787619
milestone19.0a1
Bug 787619 - Prevent clicks on the click-to-play placeholder triggering other handlers. r=jaws
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) {