Bug 1383653 P2 - 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 616807 584ef330d953bd0952261e5b3fa68eee901b56f7
parent 616806 7d76e23e42ca5dfff1e47d21da908b0b8fba9f2b
child 639601 57e0d346c9b84944a20afe295878232ba4f9b095
push id70819
push userbmo:kaku@mozilla.com
push dateThu, 27 Jul 2017 14:39:16 +0000
reviewersdao
bugs1383653, 1274919
milestone56.0a1
Bug 1383653 P2 - 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
@@ -1201,16 +1201,20 @@
                   oldFindBar.findMode == oldFindBar.FIND_NORMAL &&
                   !oldFindBar.hidden)
                 this._lastFindValue = oldFindBar._findField.value;
 
               this.updateTitlebar();
 
               this.mCurrentTab.removeAttribute("titlechanged");
               this.mCurrentTab.removeAttribute("attention");
+
+              // Call the current browser's unselectedTabHover() and with false
+              // since the tab has been selected.
+              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",