Bug 1274520 part 2 - Listen control events in video controls on system group. r=gijs
☠☠ backed out by ea60f9e94a80 ☠ ☠
authorXidorn Quan <me@upsuper.org>
Wed, 25 May 2016 09:45:56 +1000
changeset 337698 6c204be833d119fa6daae408f757e6519a531046
parent 337697 4f15271e5488bb0ce3c6f64179702fc03dc78582
child 337699 788365ddaf61746bc66479335ae72d3e566c38ec
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgijs
bugs1274520
milestone49.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 1274520 part 2 - Listen control events in video controls on system group. r=gijs MozReview-Commit-ID: Bs4MZvGefJj
toolkit/content/widgets/videocontrols.xml
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -629,18 +629,20 @@
                             this.log("!!! event " + aEvent.type + " not handled!");
                     }
                 },
 
                 terminateEventListeners : function () {
                     for (let event of this.videoEvents)
                         this.video.removeEventListener(event, this, false);
 
-                    for (let element of this.controlListeners)
-                        element.item.removeEventListener(element.event, element.func, false);
+                    for (let element of this.controlListeners) {
+                        element.item.removeEventListener(element.event, element.func,
+                                                         { mozSystemGroup: true });
+                    }
 
                     delete this.controlListeners;
 
                     this.log("--- videocontrols terminated ---");
                 },
 
                 hasError : function () {
                     return (this.video.error != null || this.video.networkState == this.video.NETWORK_NO_SOURCE);
@@ -1338,29 +1340,29 @@
                     var self = this;
 
                     this.controlListeners = [];
 
                     // Helper function to add an event listener to the given element
                     function addListener(elem, eventName, func) {
                       let boundFunc = func.bind(self);
                       self.controlListeners.push({ item: elem, event: eventName, func: boundFunc });
-                      elem.addEventListener(eventName, boundFunc, false);
+                      elem.addEventListener(eventName, boundFunc, { mozSystemGroup: true });
                     }
 
                     addListener(this.muteButton, "command", this.toggleMute);
                     addListener(this.playButton, "click", this.clickToPlayClickHandler);
                     addListener(this.fullscreenButton, "command", this.toggleFullscreen);
                     addListener(this.clickToPlay, "click", this.clickToPlayClickHandler);
                     addListener(this.controlsSpacer, "click", this.clickToPlayClickHandler);
                     addListener(this.controlsSpacer, "dblclick", this.toggleFullscreen);
 
                     addListener(this.videocontrols, "resizevideocontrols", this.adjustControlSize);
                     addListener(this.videocontrols, "transitionend", this.onTransitionEnd);
-                    addListener(this.video.ownerDocument, "mozfullscreenchange", this.onFullscreenChange);
+                    addListener(this.video.ownerDocument, "fullscreenchange", this.onFullscreenChange);
                     addListener(this.video, "keypress", this.keyHandler);
 
                     addListener(this.videocontrols, "dragstart", function(event) {
                         event.preventDefault(); //prevent dragging of controls image (bug 517114)
                     });
 
                     this.log("--- videocontrols initialized ---");
                 }
@@ -1666,18 +1668,20 @@
             randomID : 0,
             videoEvents : ["play",
                            "playing"],
             controlListeners: [],
             terminateEventListeners : function () {
               for (let event of this.videoEvents)
                 this.video.removeEventListener(event, this, false);
 
-              for (let element of this.controlListeners)
-                element.item.removeEventListener(element.event, element.func, false);
+              for (let element of this.controlListeners) {
+                element.item.removeEventListener(element.event, element.func,
+                                                 { mozSystemGroup: true });
+              }
 
               delete this.controlListeners;
             },
 
             hasError : function () {
               return (this.video.error != null || this.video.networkState == this.video.NETWORK_NO_SOURCE);
             },
 
@@ -1731,17 +1735,17 @@
               this.video = binding.parentNode;
               this.clickToPlay       = document.getAnonymousElementByAttribute(binding, "class", "clickToPlay");
               this.noControlsOverlay = document.getAnonymousElementByAttribute(binding, "class", "statusOverlay");
 
               let self = this;
               function addListener(elem, eventName, func) {
                 let boundFunc = func.bind(self);
                 self.controlListeners.push({ item: elem, event: eventName, func: boundFunc });
-                elem.addEventListener(eventName, boundFunc, false);
+                elem.addEventListener(eventName, boundFunc, { mozSystemGroup: true });
               }
               addListener(this.clickToPlay, "click", this.clickToPlayClickHandler);
               addListener(this.video, "MozNoControlsBlockedVideo", this.blockedVideoHandler);
 
               for (let event of this.videoEvents) {
                 this.video.addEventListener(event, this, false);
               }