Bug 1447544 - Set firstShow to false before the control fades out draft
authorTimothy Guan-tin Chien <timdream@gmail.com>
Thu, 05 Apr 2018 13:07:27 +0800
changeset 777695 9bec5291be35070c838fb9802f9cb816963e34bc
parent 777562 071ee904485e21e19ca08456d32bce6825b77a26
child 777696 5407dab6ac71034d66c11b8a11257f75e1b42c1f
child 777924 9f3b8ffd09713c136c782c7f7dcd8be56c61fd19
child 778513 fc00b22b83e6325c5306304b455cf4ff50c45882
push id105265
push usertimdream@gmail.com
push dateThu, 05 Apr 2018 06:41:36 +0000
bugs1447544, 1449532
milestone61.0a1
Bug 1447544 - Set firstShow to false before the control fades out The flag is used to trigger play() when the control first hides. There is no reason to set only after transition ends. We can set it to false as soon as we trigger play(). This is likely to fix a regression from bug 1449532 given that we have switched to Web Animation API there. MozReview-Commit-ID: F4n3rKdzYKr
toolkit/content/widgets/videocontrols.xml
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -1946,30 +1946,19 @@
         }, aTimeout);
       },
 
       hideControls() {
         if (!this.Utils.dynamicControls) {
           return;
         }
         this.Utils.startFadeOut(this.Utils.controlBar);
-        if (this.firstShow) {
-          this.videocontrols.addEventListener("transitionend", this);
-        }
       },
 
       handleEvent(aEvent) {
-        if (aEvent.type == "transitionend") {
-          this.firstShow = false;
-          try {
-            this.videocontrols.removeEventListener("transitionend", this);
-          } catch (ex) {}
-          return;
-        }
-
         if (this.videocontrols.randomID != this.Utils.randomID) {
           this.terminateEventListeners();
         }
       },
 
       terminateEventListeners() {
         for (var event of this.videoEvents) {
           try {
@@ -1997,16 +1986,17 @@
           self.delayHideControls(self.controlsTimeout);
         });
         this.Utils.muteButton.addEventListener("click", function() { self.delayHideControls(self.controlsTimeout); });
 
         this.Utils.controlsSpacer.addEventListener("mouseup", function(event) {
           if (event.originalTarget == self.Utils.controlsSpacer) {
             if (self.firstShow) {
               self.Utils.video.play();
+              self.firstShow = false;
             }
             self.toggleControls();
           }
         });
 
         // The first time the controls appear we want to just display
         // a play button that does not fade away. The firstShow property
         // makes that happen. But because of bug 718107 this init() method