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
--- 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",