Bug 1383653 P3 - notify the MediaDecoder::BackgroundVideoDecodingPermissionObserver when a tab is selected; r=dao
authorKaku Kuo <kaku@mozilla.com>
Tue, 25 Jul 2017 12:56:44 +0800
changeset 422907 8c470a91f0ff7617990e08e09e696612dd674d9e
parent 422906 de7f272d1f1ec89229d39f41817137e7be819f2d
child 422908 91a488108e10bfd4df90ccf8b738ae5c4a0f0dc1
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs1383653, 1274919
milestone56.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 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
@@ -1210,17 +1210,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",