Bug 1383653 P3 - notify the MediaDecoder::BackgroundVideoDecodingPermissionObserver when a tab is selected; r?dao draft
authorKaku Kuo <kaku@mozilla.com>
Tue, 25 Jul 2017 12:56:44 +0800
changeset 617176 d708dbb7c36683fc13f899d2b5dd7f2feaf3f057
parent 617175 d16a1d951627240fffee18eb9c12f63e8419c50e
child 639730 0f98929e440b2637cf4ff0067ee2998edf8231a5
push id70963
push userbmo:kaku@mozilla.com
push dateFri, 28 Jul 2017 02:58:58 +0000
reviewersdao
bugs1383653, 1274919
milestone56.0a1
Bug 1383653 P3 - notify the MediaDecoder::BackgroundVideoDecodingPermissionObserver when a tab is selected; r?dao In bug 1274919, we only distribute the hovered/un-hovered status to BackgroundVideoDecodingPermissionObserver if a tab is in the background. Consider the following steps: Step 1: move mouse to a background tab -> send the hovered event. Step 2: click on the background tab -> turn it into the foreground. Step 3: move mouse to leave the tab -> DOES NOT send un-hovered event since the tab is already in the foreground. In this way, the MediaDecoder is not notified the "un-hovered" event so it keeps wrong states. In this patch, we reset the state when a tab is selected. MozReview-Commit-ID: A4kZpwKyQCy
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1205,17 +1205,20 @@
               this.updateTitlebar();
 
               this.mCurrentTab.removeAttribute("titlechanged");
               this.mCurrentTab.removeAttribute("attention");
 
               // The tab has been selected, it's not unselected anymore.
               // (1) Call the current tab's finishUnselectedTabHoverTimer()
               //     to save a telemetry record.
+              // (2) Call the current browser's unselectedTabHover() with false
+              //     to dispatch an event.
               this.mCurrentTab.finishUnselectedTabHoverTimer();
+              this.mCurrentBrowser.unselectedTabHover(false);
             }
 
             // If the new tab is busy, and our current state is not busy, then
             // we need to fire a start to all progress listeners.
             const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
             if (this.mCurrentTab.hasAttribute("busy") && !this.mIsBusy) {
               this.mIsBusy = true;
               this._callProgressListeners(null, "onStateChange",